Commit 94f6e27b authored by Robin Dupret's avatar Robin Dupret

Tiny follow-up to #663

parent 3100f659
# Changelog
* Avoid mutating the options hash passed to a render object.
Refs #663.
*Max Schwenk*
* Fix a segfault rendering quotes using `StripDown` and the `:quote`
option.
......
......@@ -23,7 +23,7 @@ class CustomRenderTest < Redcarpet::TestCase
end
def test_renderer_options
parser = Redcarpet::Markdown.new(SimpleRender.new({ with_toc_data: true }.freeze), {})
parser = Redcarpet::Markdown.new(SimpleRender.new(with_toc_data: true))
output = parser.render("# A title")
assert_match "My little poney", output
......@@ -36,6 +36,16 @@ class CustomRenderTest < Redcarpet::TestCase
assert_match "no_intra_emphasis", output
end
def test_original_options_hash_is_not_mutated
options = { with_toc_data: true }
render = SimpleRender.new(options)
parser = Redcarpet::Markdown.new(render, tables: true)
computed_options = render.instance_variable_get(:"@options")
refute_equal computed_options.object_id, options.object_id
end
class NilPreprocessRenderer < Redcarpet::Render::HTML
def preprocess(fulldoc)
nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment