Log kramdown warnings if log level is WARN (#6522)
Merge pull request 6522
This commit is contained in:
parent
1f3ce72f6b
commit
fa22ebf056
|
@ -37,7 +37,12 @@ module Jekyll
|
|||
end
|
||||
|
||||
def convert(content)
|
||||
Kramdown::Document.new(content, @config).to_html
|
||||
document = Kramdown::Document.new(content, @config)
|
||||
html_output = document.to_html
|
||||
document.warnings.each do |warning|
|
||||
Jekyll.logger.warn "Kramdown warning:", warning
|
||||
end
|
||||
html_output
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -29,7 +29,12 @@ module Jekyll
|
|||
end
|
||||
|
||||
def convert(content)
|
||||
Kramdown::Document.new(content, @config).to_html.chomp
|
||||
document = Kramdown::Document.new(content, @config)
|
||||
html_output = document.to_html.chomp
|
||||
document.warnings.each do |warning|
|
||||
Jekyll.logger.warn "Kramdown warning:", warning
|
||||
end
|
||||
html_output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,6 +56,12 @@ class TestKramdown < JekyllUnitTest
|
|||
assert_equal "<h1>Some Header</h1>", @markdown.convert("# Some Header #").strip
|
||||
end
|
||||
|
||||
should "should log kramdown warnings" do
|
||||
allow_any_instance_of(Kramdown::Document).to receive(:warnings).and_return(["foo"])
|
||||
expect(Jekyll.logger).to receive(:warn).with("Kramdown warning:", "foo")
|
||||
@markdown.convert("Something")
|
||||
end
|
||||
|
||||
context "when asked to convert smart quotes" do
|
||||
should "convert" do
|
||||
assert_match(
|
||||
|
|
Loading…
Reference in New Issue