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
Source
# File lib/kramdown/converter/syntax_highlighter/rouge.rb, line 23 def initialize(opts = {}) @formatter = if opts[:inline_theme] ::Rouge::Formatters::HTMLInline.new(opts[:inline_theme]) else ::Rouge::Formatters::HTML.new end @formatter = ::Rouge::Formatters::HTMLTable.new(@formatter, opts) if opts[:line_numbers] if opts.fetch(:wrap, true) @pygments_wrap = opts.fetch(:css_class, 'codehilite') end end
Public Instance Methods
Source
# File lib/kramdown/converter/syntax_highlighter/rouge.rb, line 36 def stream(tokens, &b) if @pygments_wrap yield %(<div class="highlight"><pre class="#{@pygments_wrap}"><code>) end @formatter.stream(tokens, &b) if @pygments_wrap yield "</code></pre></div>" end end