Skip to content

Commit

Permalink
Support both Commonmarker pre and post 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Jan 27, 2025
1 parent efb33b5 commit cf44a71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/yard/templates/helpers/html_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ def html_markup_markdown(text)
:tables,
:with_toc_data,
:no_intraemphasis).to_html
when 'CommonMarker'
when 'Commonmarker' # GFM configs are on by default; use YARD for syntax highlighting
Commonmarker.to_html(text, options: { extension: { header_ids: nil } }, plugins: {syntax_highlighter: nil})
when 'CommonMarker' # old, pre 1.0; downstream consumers should upgrade
CommonMarker.render_html(text, %i[DEFAULT GITHUB_PRE_LANG], %i[autolink table])
else
provider.new(text).to_html
Expand Down
2 changes: 1 addition & 1 deletion lib/yard/templates/helpers/markup_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +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 => defined?(CommonMarker) ? 'CommonMarker' : "Commonmarker" }
],
:textile => [
{:lib => :redcloth, :const => 'RedCloth'}
Expand Down

0 comments on commit cf44a71

Please sign in to comment.