Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove patch to modify config for kramdown #7699

Merged
merged 2 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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