Cache converted markdown (#7159)

Merge pull request 7159
This commit is contained in:
Pat Hawks 2018-10-02 03:07:08 -05:00 committed by jekyllbot
parent 93b5b57aea
commit 18d33b1fd6
2 changed files with 7 additions and 2 deletions

View File

@ -22,6 +22,8 @@ module Jekyll
raise Errors::FatalException, "Bailing out; invalid Markdown processor."
end
@cache = Jekyll::Cache.new("Jekyll::Converters::Markdown")
@setup = true
end
@ -89,7 +91,9 @@ module Jekyll
# Returns a String of the converted content.
def convert(content)
setup
@parser.convert(content)
@cache.getset(content) do
@parser.convert(content)
end
end
private

View File

@ -32,6 +32,7 @@ class TestKramdown < JekyllUnitTest
@config = Jekyll.configuration(@config)
@markdown = Converters::Markdown.new(@config)
@markdown.setup
Jekyll::Cache.clear
end
should "fill symbolized keys into config for compatibility with kramdown" do
@ -94,7 +95,7 @@ class TestKramdown < JekyllUnitTest
MARKDOWN
div_highlight = ">div.highlight"
selector = "div.highlighter-rouge#{div_highlight}>pre.highlight>code"
refute result.css(selector).empty?
refute(result.css(selector).empty?, result.to_html)
end
context "when a custom highlighter is chosen" do