imathis/octopress — Issue #382: Propose an alternative to pygments.rb for syntax highlighting
Author: Rolinh
Created: 2012-01-17 17:02:20+00:00
State: open

As of today, Octopress uses pygments.rb (https://github.com/tmm1/pygments.rb) for code syntax highlighting. However, this gem is a ruby wrapper for the python pygments syntax highlighter (http://pygments.org/). This has lead to some bugs (see theses issues: https://github.com/imathis/octopress/issues/350, https://github.com/imathis/octopress/issues/251 and some upstream (on pygments.rb) https://github.com/tmm1/pygments.rb/issues/10) and this will probably lead to some more bugs in the future. Moreover, I do not think using a python wrapper for syntax highlighting is a clean solution.

I believe Octopress uses pygments because of the lack of a nicer rubygem for syntax highlighting (the 'syntax' gem (http://syntax.rubyforge.org/) has been untouched for about 7 years now and the 'ultraviolet' gem (http://ultraviolet.rubyforge.org/) for 4 years).

However, I discovered Coderay (https://github.com/rubychan/coderay) which seems to be able to replace pygments.rb. It is actively developed (last stable release is from 3 weeks ago). I know that for now, it does not support as many languages as pygments.rb (only 19 as of today) but a lot more languages are to be added for the next major version (1.1, see here: http://odd-eyed-code.org/versions/show/15) so a total of 40 languages should be supported.

Maybe it would be a good idea to switch to it when version 1.1 is out so we could have a nice ruby solution and get rid of potential future bugs with pygments.rb.