lib/rack/highlighter.rb in rack-highlighter-0.1.0 vs lib/rack/highlighter.rb in rack-highlighter-0.2.0
- old
+ new
@@ -87,9 +87,15 @@
def pygments(lang, code, options)
Pygments.highlight(code, formatter: 'html', lexer: lang, options: options)
end
+ def rouge(lang, code, options)
+ lexer = Rouge::Lexer.find_fancy(lang, code) || Rouge::Lexers::Text
+ formatter = Rouge::Formatters::HTML.new(options)
+ formatter.format(lexer.lex(code))
+ end
+
def ultraviolet(lang, code, options)
Uv.parse(code, 'xhtml', lang, options[:lines], options[:theme])
end
end