lib/rouge/plugins/redcarpet.rb in rouge-0.1.1 vs lib/rouge/plugins/redcarpet.rb in rouge-0.1.2

- old
+ new

@@ -26,9 +26,16 @@ lexer = Lexer.guess(:source => code, :mimetype => opts[:mimetype]) when String Lexer.find(name) end || Lexers::Text + # XXX HACK: Redcarpet strips hard tabs out of code blocks, + # so we assume you're not using leading spaces that aren't tabs, + # and just replace them here. + if lexer_class.tag == 'make' + code.gsub! /^ /, "\t" + end + lexer = lexer_class.new(opts) formatter = Formatters::HTML.new(:css_class => "highlight #{lexer_class.tag}") Rouge.highlight(code, lexer, formatter) end