Skip to content

Commit d3430c3

Browse files
committed
feat(commonmarker): add commonmarker_exts to options
1 parent 3e973e5 commit d3430c3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/github/markup/markdown.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ class Markdown < Implementation
66
MARKDOWN_GEMS = {
77
"commonmarker" => proc { |content, options: {}|
88
commonmarker_opts = [:GITHUB_PRE_LANG].concat(options.fetch(:commonmarker_opts, []))
9-
CommonMarker.render_html(content, commonmarker_opts, [:tagfilter, :autolink, :table, :strikethrough])
9+
commonmarker_exts = options.fetch(:commonmarker_exts, [:tagfilter, :autolink, :table, :strikethrough])
10+
CommonMarker.render_html(content, commonmarker_opts, commonmarker_exts)
1011
},
1112
"github/markdown" => proc { |content, options: {}|
1213
GitHub::Markdown.render(content)

test/markup_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,8 @@ def test_commonmarker_options
120120

121121
assert_equal "<p>hello <!-- raw HTML omitted --> world</p>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello <bad> world")
122122
assert_equal "<p>hello <bad> world</p>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello <bad> world", options: {commonmarker_opts: [:UNSAFE]})
123+
124+
assert_equal "&lt;style>.red{color: #ff2727;}&lt;/style>\n", GitHub::Markup.render("test.md", "<style>.red{color: #ff2727;}</style>", options: {commonmarker_opts: [:UNSAFE]})
125+
assert_equal "<style>.red{color: #ff2727;}</style>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "<style>.red{color: #ff2727;}</style>", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]})
123126
end
124127
end

0 commit comments

Comments
 (0)