Syntax highlighting using the pygments.com "web service".
I have historically used ultraviolet for any syntax highlighting. However, in order to use ultraviolet, you need to be able to use the oniguruma library. Unfortunately, some hosting services (like the Media Temple grid service) do not support this library. I needed another solution, and it seemed like something that could be outsourced.
Run the following if you haven't already:
$ gem sources -a http://gems.github.com
Install the gem(s):
$ sudo gem install -r sbfaulkner-pygmalion
require 'pygmalion' ... string.highlight string.highlight(:language => 'js') string.highlight(:language => 'rb', :line_numbers => true)
From the command-line...
Usage: pygmalion [options] [file ...] Options: -h, --help Display this message. -l, --language=name The language for the code to be highlighted. -n, --line-numbers Include line numbers.
<div class="highlight"><pre><span class="k">def</span> <span class="nf">hello</span> <span class="n">puts</span> <span class="s">"hello"</span> <span class="n">end</span> </pre></div>'
Author: S. Brent Faulkner email@example.com
License: Copyright © 2008 unwwwired.net, released under the MIT license