Skip to content

Commit

Permalink
Support Commonmarker (lowercase m) from v1.x
Browse files Browse the repository at this point in the history
Fixes lsegal#1528

Co-Authored-By: Andrew Haines <[email protected]>
  • Loading branch information
ParadoxV5 and haines committed Mar 23, 2024
1 parent 2c0bac2 commit 3472342
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/yard/templates/helpers/html_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def html_markup_markdown(text)
:tables,
:with_toc_data,
:no_intraemphasis).to_html
when 'Commonmarker'
Commonmarker.to_html(text) # GFM configs are on by default
when 'CommonMarker'
CommonMarker.render_html(text, %i[DEFAULT GITHUB_PRE_LANG], %i[autolink table])
else
Expand Down
1 change: 1 addition & 0 deletions lib/yard/templates/helpers/markup_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def clear_markup_cache
{:lib => :maruku, :const => 'Maruku'},
{:lib => :'rpeg-markdown', :const => 'PEGMarkdown'},
{:lib => :rdoc, :const => 'YARD::Templates::Helpers::Markup::RDocMarkdown'},
{:lib => :commonmarker, :const => 'Commonmarker'},
{:lib => :commonmarker, :const => 'CommonMarker'}
],
:textile => [
Expand Down
2 changes: 1 addition & 1 deletion spec/templates/helpers/html_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def options

it "creates tables (markdown specific)" do
log.enter_level(Logger::FATAL) do
supports_table = %w(RedcarpetCompat Kramdown::Document CommonMarker)
supports_table = %w(RedcarpetCompat Kramdown::Document Commonmarker CommonMarker)
unless supports_table.include?(markup_class(:markdown).to_s)
pending "This test depends on a markdown engine that supports tables"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
end
end

describe 'CommonMarker', if: RUBY_VERSION >= '2.3' do
describe 'Commonmarker', if: RUBY_VERSION >= '2.3' do
let(:markup) { :markdown }
let(:markup_provider) { :commonmarker }

Expand Down

0 comments on commit 3472342

Please sign in to comment.