0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for the Pygments syntax highlighter.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 0.5.3
 Project Readme

rb-pygments

This is a wrapper for the Pygments syntax highlighter. It can be used to highlight a wide variety of languages in a wide variety of formats.

API documentation is available on rdoc.info.

Usage

All functionality is available through the {Pygments} module. Highlighting is done via the {Pygments.highlight highlight} method, like so (reformatted for readability:

Pygments.highlight("Some.ruby(:code)", :ruby, :html, :nowrap => true)
  #=> <span class="no">Some</span>
      <span class="o">.</span>
      <span class="n">ruby</span>
      <span class="p">(</span>
      <span class="ss">:code</span>
      <span class="p">)</span>

Stylesheets and such can be retrieved via the {Pygments.style style} method.

Requirements

rb-pygments requires that Pygments be installed. Since Pygments is written in Python, it needs to be installed manually. If you've got easy_install, you can do

!!!sh
easy_install Pygments

Otherwise, it can be downloaded here.