Merge branch 'ashmaroli-kramdown-warning-config'

This commit is contained in:
Frank Taillandier 2017-12-07 19:56:01 +01:00
commit 23c3484660
No known key found for this signature in database
GPG Key ID: E73258E3F50AEB7E
5 changed files with 11 additions and 4 deletions

View File

@ -688,6 +688,7 @@ kramdown:
input: GFM
hard_wrap: false
footnote_nr: 1
show_warnings: false
```
## Liquid Options

View File

@ -80,6 +80,7 @@ module Jekyll
"input" => "GFM",
"hard_wrap" => false,
"footnote_nr" => 1,
"show_warnings" => false,
},
}.map { |k, v| [k, v.freeze] }].freeze

View File

@ -39,8 +39,10 @@ module Jekyll
def convert(content)
document = Kramdown::Document.new(content, @config)
html_output = document.to_html
document.warnings.each do |warning|
Jekyll.logger.warn "Kramdown warning:", warning
if @config["show_warnings"]
document.warnings.each do |warning|
Jekyll.logger.warn "Kramdown warning:", warning
end
end
html_output
end

View File

@ -36,8 +36,10 @@ module Jekyll
def convert(content)
document = Kramdown::Document.new(content, @config)
html_output = document.to_html.chomp
document.warnings.each do |warning|
Jekyll.logger.warn "Kramdown warning:", warning
if @config["show_warnings"]
document.warnings.each do |warning|
Jekyll.logger.warn "Kramdown warning:", warning.sub(%r!^Warning:\s+!, "")
end
end
html_output
end

View File

@ -13,6 +13,7 @@ class TestKramdown < JekyllUnitTest
"toc_levels" => "1..6",
"auto_ids" => false,
"footnote_nr" => 1,
"show_warnings" => true,
"syntax_highlighter" => "rouge",
"syntax_highlighter_opts" => {