class Kramdown::Converter::SyntaxHighlighter::Rouge::HTMLLegacy
This is the HTMLLegacy implementation from Rouge that is deprecated. Therefore it is reproduced here and only adapted as needed.
Public Class Methods
new(opts = {})
click to toggle source
# File lib/kramdown/converter/syntax_highlighter/rouge.rb 23 def initialize(opts = {}) 24 @formatter = if opts[:inline_theme] 25 ::Rouge::Formatters::HTMLInline.new(opts[:inline_theme]) 26 else 27 ::Rouge::Formatters::HTML.new 28 end 29 @formatter = ::Rouge::Formatters::HTMLTable.new(@formatter, opts) if opts[:line_numbers] 30 31 if opts.fetch(:wrap, true) 32 @pygments_wrap = opts.fetch(:css_class, 'codehilite') 33 end 34 end
Public Instance Methods
stream(tokens) { |%(<div class="highlight"><pre class="#{pygments_wrap}"><code>)| ... }
click to toggle source
# File lib/kramdown/converter/syntax_highlighter/rouge.rb 36 def stream(tokens, &b) 37 if @pygments_wrap 38 yield %(<div class="highlight"><pre class="#{@pygments_wrap}"><code>) 39 end 40 41 @formatter.stream(tokens, &b) 42 43 if @pygments_wrap 44 yield "</code></pre></div>" 45 end 46 end