add option to configure kramdown warning output
This commit is contained in:
parent
525efbc2f8
commit
77852b8838
|
@ -688,6 +688,7 @@ kramdown:
|
||||||
input: GFM
|
input: GFM
|
||||||
hard_wrap: false
|
hard_wrap: false
|
||||||
footnote_nr: 1
|
footnote_nr: 1
|
||||||
|
log_warnings: false
|
||||||
```
|
```
|
||||||
|
|
||||||
## Liquid Options
|
## Liquid Options
|
||||||
|
|
|
@ -80,6 +80,7 @@ module Jekyll
|
||||||
"input" => "GFM",
|
"input" => "GFM",
|
||||||
"hard_wrap" => false,
|
"hard_wrap" => false,
|
||||||
"footnote_nr" => 1,
|
"footnote_nr" => 1,
|
||||||
|
"log_warnings" => false,
|
||||||
},
|
},
|
||||||
}.map { |k, v| [k, v.freeze] }].freeze
|
}.map { |k, v| [k, v.freeze] }].freeze
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,12 @@ module Jekyll
|
||||||
|
|
||||||
def convert(content)
|
def convert(content)
|
||||||
document = Kramdown::Document.new(content, @config)
|
document = Kramdown::Document.new(content, @config)
|
||||||
html_output = document.to_html
|
if @config["log_warnings"]
|
||||||
document.warnings.each do |warning|
|
document.warnings.each do |warning|
|
||||||
Jekyll.logger.warn "Kramdown warning:", warning
|
Jekyll.logger.warn "Kramdown warning:", warning
|
||||||
end
|
end
|
||||||
html_output
|
end
|
||||||
|
document.to_html
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -30,11 +30,12 @@ module Jekyll
|
||||||
|
|
||||||
def convert(content)
|
def convert(content)
|
||||||
document = Kramdown::Document.new(content, @config)
|
document = Kramdown::Document.new(content, @config)
|
||||||
html_output = document.to_html.chomp
|
if @config["log_warnings"]
|
||||||
document.warnings.each do |warning|
|
document.warnings.each do |warning|
|
||||||
Jekyll.logger.warn "Kramdown warning:", warning
|
Jekyll.logger.warn "Kramdown warning:", warning.sub(%r!^Warning:\s+!, "")
|
||||||
end
|
end
|
||||||
html_output
|
end
|
||||||
|
document.to_html.chomp
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,7 @@ class TestKramdown < JekyllUnitTest
|
||||||
"toc_levels" => "1..6",
|
"toc_levels" => "1..6",
|
||||||
"auto_ids" => false,
|
"auto_ids" => false,
|
||||||
"footnote_nr" => 1,
|
"footnote_nr" => 1,
|
||||||
|
"log_warnings" => true,
|
||||||
|
|
||||||
"syntax_highlighter" => "rouge",
|
"syntax_highlighter" => "rouge",
|
||||||
"syntax_highlighter_opts" => {
|
"syntax_highlighter_opts" => {
|
||||||
|
|
Loading…
Reference in New Issue