in-progress patch for maruku and fenced code blocks
This commit is contained in:
parent
d2e948600f
commit
14418f74ae
|
@ -8,6 +8,12 @@ module Jekyll
|
||||||
@errors = []
|
@errors = []
|
||||||
load_divs_library if @config['maruku']['use_divs']
|
load_divs_library if @config['maruku']['use_divs']
|
||||||
load_blahtext_library if @config['maruku']['use_tex']
|
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
|
rescue LoadError
|
||||||
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
||||||
STDERR.puts ' $ [sudo] gem install maruku'
|
STDERR.puts ' $ [sudo] gem install maruku'
|
||||||
|
|
|
@ -451,5 +451,51 @@ CONTENT
|
||||||
assert_match "<span id='include-param' />", @result
|
assert_match "<span id='include-param' />", @result
|
||||||
end
|
end
|
||||||
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\">"Hello world"</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 "Hello world"\n</code></pre>", @markdown.convert(
|
||||||
|
<<-EOS
|
||||||
|
```ruby
|
||||||
|
puts "Hello world"
|
||||||
|
```
|
||||||
|
EOS
|
||||||
|
).strip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue