ddollar / albino forked from github/albino

Ruby wrapper for the Pygments syntax highlighter.

This URL has Read+Write access

albino /
name age message
file .gitignore Loading commit data...
file README.rdoc
file Rakefile
file albino.gemspec
directory config/
directory lib/
README.rdoc

Albino

Installation

    $ gem sources -a http://gems.github.com
    $ gem install ddollar-albino

Usage

To print out an HTMLized, Ruby-highlighted version of ’/some/file.rb’

    @syntaxer = Albino.new('/some/file.rb', :ruby)
    puts @syntaxer.colorize

To use another formatter, pass it as the third argument:

    @syntaxer = Albino.new('/some/file.rb', :ruby, :bbcode)
    puts @syntaxer.colorize

You can also use the #colorize class method:

    puts Albino.colorize('/some/file.rb', :ruby)

Another also: you get a #to_s, for somewhat nicer use in Rails views.

    ... helper file ...
    def highlight(text)
      Albino.new(text, :ruby)
    end

    ... view file ...
    <%= highlight text %>

The default lexer is ‘text’. You need to specify a lexer yourself; because we are using STDIN there is no auto-detect.

To see all lexers and formatters available, run `pygmentize -L`.

Documentation

RDoc can be found at ddollar.github.com/albino

Credits

This project is an extraction from GitHub.

For this and other extractions, see github.com/github

The Albino code was all written by Chris Wanstrath chris@ozmm.org

Wrapped in a gem by David Dollar daviddollar.org