Use #require_with_graceful_fail in Highlight tag.

This commit is contained in:
Parker Moore 2015-01-31 13:52:26 -08:00
parent 6883a0b397
commit 336bb44750
1 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,7 @@ eos
end
def render_pygments(code, is_safe)
require 'pygments'
Jekyll::External.require_with_graceful_fail 'pygments'
@options[:encoding] = 'utf-8'
@ -100,7 +100,7 @@ eos
end
def render_rouge(code)
require 'rouge'
Jekyll::External.require_with_graceful_fail 'rouge'
formatter = Rouge::Formatters::HTML.new(line_numbers: @options[:linenos], wrap: false)
lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
code = formatter.format(lexer.lex(code))