module Kramdown::Converter::SyntaxHighlighter::Rouge
Uses Rouge which is CSS-compatible to Pygments to highlight code blocks and code spans.
Constants
- AVAILABLE
Highlighting via Rouge is available if this constant is
true
.
Public Class Methods
call(converter, text, lang, type, _unused_opts)
click to toggle source
# File lib/kramdown/converter/syntax_highlighter/rouge.rb, line 23 def self.call(converter, text, lang, type, _unused_opts) opts = converter.options[:syntax_highlighter_opts].dup lexer = ::Rouge::Lexer.find_fancy(lang || opts[:default_lang], text) return nil unless lexer opts[:wrap] = false if type == :span formatter = ::Rouge::Formatters::HTML.new(opts) formatter.format(lexer.lex(text)) end