Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 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,9 @@ def html_markup_markdown(text)
:tables,
:with_toc_data,
:no_intraemphasis).to_html
when 'Commonmarker'
# GFM configs are on by default; use YARD for syntax highlighting
Commonmarker.to_html(text, plugins: {syntax_highlighter: nil})
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 @@ -26,7 +26,7 @@

before(:each) do
if html_renderer.markup_class(markup).nil?
skip "Missing markup renderer #{markup}"
raise "Missing markup renderer #{markup}"
end
end

Expand Down
11 changes: 1 addition & 10 deletions spec/templates/markup_processor_integrations/markdown_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,17 @@

include_examples 'shared examples for markdown processors'


it 'generates anchor tags for level 2 header' do
expect(rendered_document).to include('<h2 id="example-code-listings">Example code listings</h2>')
end

it 'does not create line break via backslash' do
expect(rendered_document).to include("commonmark line break with\\\na backslash")
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 }

include_examples 'shared examples for markdown processors'

it 'generates level 2 header without id' do
expect(rendered_document).to include('<h2>Example code listings</h2>')
end

it 'creates line break via backslash' do
expect(rendered_document).to include("commonmark line break with<br />\na backslash")
end
Expand Down