Skip to content

Commit

Permalink
Remove patch to modify config for kramdown (#7699)
Browse files Browse the repository at this point in the history
Merge pull request 7699
  • Loading branch information
ashmaroli authored and jekyllbot committed Jun 28, 2019
1 parent c87f5fa commit 3e8e6d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
8 changes: 0 additions & 8 deletions lib/jekyll/converters/markdown/kramdown_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def setup
@config["syntax_highlighter_opts"]["guess_lang"] = @config["guess_lang"]
@config["coderay"] ||= {} # XXX: Legacy.
modernize_coderay_config
make_accessible
end

def convert(content)
Expand Down Expand Up @@ -64,13 +63,6 @@ def load_dependencies
end
end

def make_accessible(hash = @config)
hash.keys.each do |key|
hash[key.to_sym] = hash[key]
make_accessible(hash[key]) if hash[key].is_a?(Hash)
end
end

# config[kramdown][syntax_higlighter] >
# config[kramdown][enable_coderay] >
# config[highlighter]
Expand Down
23 changes: 5 additions & 18 deletions test/test_kramdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class TestKramdown < JekyllUnitTest
"css" => :class,
"css_class" => "highlight",
"formatter" => ::Rouge::Formatters::HTMLLegacy,
"foobar" => "lipsum",
},
},
}
Expand All @@ -35,24 +36,10 @@ class TestKramdown < JekyllUnitTest
Jekyll::Cache.clear
end

should "fill symbolized keys into config for compatibility with kramdown" do
kramdown_config = @markdown.instance_variable_get(:@parser)
.instance_variable_get(:@config)

@kramdown_config_keys.each do |key|
assert kramdown_config.key?(key.to_sym),
"Expected #{kramdown_config} to include key #{key.to_sym.inspect}"
end

@syntax_highlighter_opts_config_keys.each do |key|
assert kramdown_config["syntax_highlighter_opts"].key?(key.to_sym),
"Expected #{kramdown_config["syntax_highlighter_opts"]} to include " \
"key #{key.to_sym.inspect}"
end

assert_equal kramdown_config["smart_quotes"], kramdown_config[:smart_quotes]
assert_equal kramdown_config["syntax_highlighter_opts"]["css"],
kramdown_config[:syntax_highlighter_opts][:css]
should "not break kramdown" do
kramdown_doc = Kramdown::Document.new("# Some Header #", @config["kramdown"])
assert_equal :class, kramdown_doc.options[:syntax_highlighter_opts][:css]
assert_equal "lipsum", kramdown_doc.options[:syntax_highlighter_opts][:foobar]
end

should "run Kramdown" do
Expand Down

0 comments on commit 3e8e6d2

Please sign in to comment.