mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Add support for the Rouge syntax highlighter
By setting the `highlighter` setting to `rouge` you can now easily highlight your code with it instead of relying on Pygments. However, Jekyll doesn't depend on Rouge explicitly, you will need to install it or add it to your Gemfile. The documentation has been updated accordingly.
This commit is contained in:
@@ -42,6 +42,22 @@ puts "Hello world"
|
||||
end
|
||||
end
|
||||
|
||||
context "with rouge enabled" do
|
||||
setup do
|
||||
@markdown = Converters::Markdown.new @config.merge({ 'highlighter' => 'rouge' })
|
||||
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 "without any highlighter" do
|
||||
setup do
|
||||
@markdown = Converters::Markdown.new @config.merge({ 'highlighter' => nil })
|
||||
|
||||
Reference in New Issue
Block a user