Module: Kramdown::SyntaxHighlighter::Rouge
- Defined in:
- lib/nesta-contentfocus-extensions/kramdown.rb
Class Method Summary collapse
Class Method Details
.call(converter, text, lang, type, _unused_opts) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/nesta-contentfocus-extensions/kramdown.rb', line 12 def self.call(converter, text, lang, type, _unused_opts) opts = converter.[:syntax_highlighter_opts].dup lexer = ::Rouge::Lexer.find_fancy(lang || opts[:default_lang], text) return nil unless lexer if type == :span opts[:wrap] = false opts[:line_numbers] = false end formatter = (opts.delete(:formatter) || ::Rouge::Formatters::HTML).new(opts) formatter.format(lexer.lex(text)) end |