in-progress patch for maruku and fenced code blocks

This commit is contained in:
Eric Mill 2013-12-08 22:37:46 -05:00
parent d2e948600f
commit 14418f74ae
2 changed files with 52 additions and 0 deletions

View File

@ -8,6 +8,12 @@ module Jekyll
@errors = []
load_divs_library if @config['maruku']['use_divs']
load_blahtext_library if @config['maruku']['use_tex']
# allow fenced code blocks (new in Maruku 0.7.0)
if @config['maruku']['fenced_code_blocks']
MaRuKu::Globals[:fenced_code_blocks] = true
end
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install maruku'

View File

@ -451,5 +451,51 @@ CONTENT
assert_match "<span id='include-param' />", @result
end
end
context "with maruku and fenced code blocks with backticks" do
setup do
@config = {
'markdown' => 'maruku',
'maruku' => {
'fenced_code_blocks' => true
}
}
end
# context "with pygments enabled" do
# setup do
# @markdown = Converters::Markdown.new @config.merge({ 'pygments' => true })
# end
# should "render fenced code blocks with syntax highlighting" do
# assert_equal "<div class=\"highlight\"><pre><code class=\"ruby language-ruby\" data-lang=\"ruby\"><span class=\"nb\">puts</span> <span class=\"s2\">&quot;Hello world&quot;</span>\n</code></pre></div>", @markdown.convert(
# <<-EOS
# ```ruby
# puts "Hello world"
# ```
# EOS
# ).strip
# end
# end
context "with pygments disabled" do
setup do
@markdown = Converters::Markdown.new @config.merge({ 'pygments' => false })
end
should "render fenced code blocks without syntax highlighting" do
assert_equal "<pre class=\"ruby\"><code class=\"ruby\">\nputs &quot;Hello world&quot;\n</code></pre>", @markdown.convert(
<<-EOS
```ruby
puts "Hello world"
```
EOS
).strip
end
end
end
end
end