diff --git a/lib/commonmarker/config.rb b/lib/commonmarker/config.rb index 23e4b018..0de5594a 100644 --- a/lib/commonmarker/config.rb +++ b/lib/commonmarker/config.rb @@ -62,9 +62,9 @@ class << self def process_options(options) { - parse: process_parse_options(options[:parse]), - render: process_render_options(options[:render]), - extension: process_extension_options(options[:extension]), + parse: process_parse_options(options[:parse].dup), + render: process_render_options(options[:render].dup), + extension: process_extension_options(options[:extension].dup), } end diff --git a/lib/commonmarker/version.rb b/lib/commonmarker/version.rb index 7bdc3a25..8ceb4d06 100644 --- a/lib/commonmarker/version.rb +++ b/lib/commonmarker/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Commonmarker - VERSION = "2.0.0" + VERSION = "2.0.1" end diff --git a/test/config_test.rb b/test/config_test.rb index 4771838e..ccabe2b3 100644 --- a/test/config_test.rb +++ b/test/config_test.rb @@ -45,4 +45,39 @@ def test_config_merges_directly # hardbreaks still work assert_equal("

aaaa
\nbbbb

\n", Commonmarker.to_html("aaaa\nbbbb", options: { render: { unsafe: false } })) end + + def test_same_config_again + user_config = { + extension: { + header_ids: nil, + }, + } + + text = "# Heading-1" + expected = "

Heading-1

\n" + + assert_equal(expected, Commonmarker.to_html(text, options: user_config)) + + # expect same result + assert_equal(expected, Commonmarker.to_html(text, options: user_config)) + end + + def test_render_and_to_html_with_same_config + user_config = { + extension: { + header_ids: nil, + }, + } + + text = "# Heading-1" + expected = "

Heading-1

\n" + + doc = Commonmarker.parse(text, options: user_config) + # doc.walk do |node| + # # do something + # end + doc.to_html(options: user_config) + + assert_equal(expected, Commonmarker.to_html(text, options: user_config)) + end end