Sha256: 124019029772a0ac718f4b4d9da835388a7e8d70edce3eb536cc93da9a107069
Contents?: true
Size: 695 Bytes
Versions: 18
Compression:
Stored size: 695 Bytes
Contents
# this file is not require'd from the root. To use this plugin, run: # # require 'rouge/plugins/redcarpet' module Rouge module Plugins module Redcarpet def block_code(code, language) lexer = Lexer.find_fancy(language, code) || 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.tag == 'make' code.gsub! /^ /, "\t" end formatter = Formatters::HTML.new( :css_class => "highlight #{lexer.tag}" ) formatter.format(lexer.lex(code)) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems