diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 11cf662d..7952bd3b 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -6,7 +6,8 @@ class Markdown < Implementation MARKDOWN_GEMS = { "commonmarker" => proc { |content, options: {}| commonmarker_opts = [:GITHUB_PRE_LANG].concat(options.fetch(:commonmarker_opts, [])) - CommonMarker.render_html(content, commonmarker_opts, [:tagfilter, :autolink, :table, :strikethrough]) + commonmarker_exts = options.fetch(:commonmarker_exts, [:tagfilter, :autolink, :table, :strikethrough]) + CommonMarker.render_html(content, commonmarker_opts, commonmarker_exts) }, "github/markdown" => proc { |content, options: {}| GitHub::Markdown.render(content) diff --git a/test/markup_test.rb b/test/markup_test.rb index 1ff2272a..da859944 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -120,5 +120,8 @@ def test_commonmarker_options assert_equal "

hello world

\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello world") assert_equal "

hello world

\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello world", options: {commonmarker_opts: [:UNSAFE]}) + + assert_equal "<style>.red{color: #ff2727;}</style>\n", GitHub::Markup.render("test.md", "", options: {commonmarker_opts: [:UNSAFE]}) + assert_equal "\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]}) end end