diff --git a/lib/yard/templates/helpers/html_helper.rb b/lib/yard/templates/helpers/html_helper.rb index 850d842c0..f0b76c95c 100644 --- a/lib/yard/templates/helpers/html_helper.rb +++ b/lib/yard/templates/helpers/html_helper.rb @@ -93,7 +93,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 diff --git a/lib/yard/templates/helpers/markup_helper.rb b/lib/yard/templates/helpers/markup_helper.rb index 9d7a6dcd1..dddc5d395 100644 --- a/lib/yard/templates/helpers/markup_helper.rb +++ b/lib/yard/templates/helpers/markup_helper.rb @@ -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'} diff --git a/spec/templates/markup_processor_integrations/markdown_spec.rb b/spec/templates/markup_processor_integrations/markdown_spec.rb index 8581f7dd8..ca91cf2a5 100644 --- a/spec/templates/markup_processor_integrations/markdown_spec.rb +++ b/spec/templates/markup_processor_integrations/markdown_spec.rb @@ -82,7 +82,7 @@ end end - describe 'CommonMarker', if: RUBY_VERSION >= '2.3' do + describe defined?(CommonMarker) ? 'CommonMarker' : "Commonmarker", if: RUBY_VERSION >= '2.3' do let(:markup) { :markdown } let(:markup_provider) { :commonmarker }