module Rouge

The containing module for Rouge

not required by the main lib. to use this module, require 'rouge/cli'.

ABAP elements taken from help.sap.com/abapdocu_750/en/index.htm?file=abapdo.htm

TODO: Implement format list support.

automatically generated by `rake builtins:gherkin`

vim: set ts=2 sw=2 et:

automatically generated by `rake builtins:lua`

automatically generated by `rake builtins:mathematica`

automatically generated by `rake builtins:matlab`

automatically generated by `rake builtins:php`

automatically generated by `rake builtins:sqf`

DO NOT EDIT: automatically generated by `rake builtins:vim`. see tasks/vim.rake for more info.

this file is not require'd from the root. To use this plugin, run:

require 'rouge/plugins/redcarpet'

TODO how are we going to handle soft/hard contrast?

Public Class Methods

highlight(text, lexer, formatter, &b) click to toggle source

Highlight some text with a given lexer and formatter.

@example

Rouge.highlight('@foo = 1', 'ruby', 'html')
Rouge.highlight('var foo = 1;', 'js', 'terminal256')

# streaming - chunks become available as they are lexed
Rouge.highlight(large_string, 'ruby', 'html') do |chunk|
  $stdout.print chunk
end
# File lib/rouge.rb, line 24
def highlight(text, lexer, formatter, &b)
  lexer = Lexer.find(lexer) unless lexer.respond_to? :lex
  raise "unknown lexer #{lexer}" unless lexer

  formatter = Formatter.find(formatter) unless formatter.respond_to? :format
  raise "unknown formatter #{formatter}" unless formatter

  formatter.format(lexer.lex(text), &b)
end
reload!() click to toggle source
# File lib/rouge.rb, line 9
def reload!
  Object.send :remove_const, :Rouge
  load __FILE__
end
version() click to toggle source
# File lib/rouge/version.rb, line 4
def self.version
  "3.3.0"
end