diff --git a/lib/kramdown/converter/syntax_highlighter/rouge.rb b/lib/kramdown/converter/syntax_highlighter/rouge.rb index c799526c..ed6a4f83 100644 --- a/lib/kramdown/converter/syntax_highlighter/rouge.rb +++ b/lib/kramdown/converter/syntax_highlighter/rouge.rb @@ -70,7 +70,7 @@ def self.formatter_class(opts = {}) when Class formatter when /\A[[:upper:]][[:alnum:]_]*\z/ - ::Rouge::Formatters.const_get(formatter) + ::Rouge::Formatters.const_get(formatter, false) else # Available in Rouge 2.0 or later ::Rouge::Formatters::HTMLLegacy diff --git a/test/test_files.rb b/test/test_files.rb index b446b3bc..7e2ccad3 100644 --- a/test/test_files.rb +++ b/test/test_files.rb @@ -21,16 +21,20 @@ end # custom formatter for tests - class RougeHTMLFormatters < Kramdown::Converter::SyntaxHighlighter::Rouge.formatter_class + module Rouge + module Formatters + class RougeHTMLFormatters < Kramdown::Converter::SyntaxHighlighter::Rouge.formatter_class - tag 'rouge_html_formatters' + tag 'rouge_html_formatters' - def stream(tokens, &b) - yield %(
) - super - yield %(
) - end + def stream(tokens, &b) + yield %(
) + super + yield %(
) + end + end + end end rescue LoadError, SyntaxError, NameError end