Method: Kramdown::Converter::SyntaxHighlighter::Rouge.formatter_class

Defined in:
lib/kramdown/converter/syntax_highlighter/rouge.rb

.formatter_class(opts = {}) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/kramdown/converter/syntax_highlighter/rouge.rb', line 68

def self.formatter_class(opts = {})
  case formatter = opts[:formatter]
  when Class
    formatter
  when /\A[[:upper:]][[:alnum:]_]*\z/
    ::Rouge::Formatters.const_get(formatter, false)
  else
    # Available in Rouge 2.0 or later
    ::Rouge::Formatters::HTMLLegacy
  end
rescue NameError
  # Fallback to Rouge 1.x
  ::Rouge::Formatters::HTML
end