diff --git a/lib/github/markup.rb b/lib/github/markup.rb index 444907a3..1c63c8bd 100644 --- a/lib/github/markup.rb +++ b/lib/github/markup.rb @@ -47,11 +47,11 @@ def render(filename, content, symlink: false, options: {}) end end - def render_s(symbol, content) + def render_s(symbol, content, options: {}) raise ArgumentError, 'Can not render a nil.' if content.nil? if markups.key?(symbol) - markups[symbol].render(nil, content) + markups[symbol].render(nil, content, options: options) else content end diff --git a/test/markup_test.rb b/test/markup_test.rb index 86c83ee7..1ff2272a 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -72,7 +72,7 @@ def call message end end - + def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html', '

Title

') assert_equal true, GitHub::Markup.can_render?('README.markdown', '=== Title') @@ -92,7 +92,7 @@ def test_each_render_has_a_name assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin pod').name end - + def test_rendering_by_symbol assert_equal '

test

', GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '`test`').strip end @@ -117,5 +117,8 @@ def test_preserve_markup def test_commonmarker_options assert_equal "

hello world

\n", GitHub::Markup.render("test.md", "hello world") assert_equal "

hello world

\n", GitHub::Markup.render("test.md", "hello world", options: {commonmarker_opts: [:UNSAFE]}) + + 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]}) end end