Class/Module Index [+]

Quicksearch

Rouge::Plugins::Redcarpet

Public Instance Methods

block_code(code, language) click to toggle source
# File lib/rouge/plugins/redcarpet.rb, line 8
def block_code(code, language)
  lexer = Lexer.find_fancy(language, code) || Lexers::PlainText

  # 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 = rouge_formatter(
    :css_class => "highlight #{lexer.tag}"
  )

  formatter.format(lexer.lex(code))
end

Protected Instance Methods

rouge_formatter(opts={}) click to toggle source
# File lib/rouge/plugins/redcarpet.rb, line 26
def rouge_formatter(opts={})
  Formatters::HTML.new(opts)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.