Sun 2012-10-21 ( In En pr )

I totally missed this new Rouge gem which came out in September. It’s a Pygments port in pure Ruby!

Jay Adkisson did a great job in my opinion, and the project is destined to become popular — I guess, in the long run, even more popular than CodeRay. Like Pygments, it has a long list of supported languages, a plethora of compatible stylesheets (even with 256 color terminal output), and the ability to guess the language of a piece of code.

If you’re using CodeRay or one of the Pygments wrappers, you should definitely check out this project.

Rouge also inherits from Pygments the DSL-based lexer definitions, which means it’s much cleaner to maintain, and also slower to execute.

Here’s a very quick benchmark that helped me to get a first impression:

The last number is based on two performance patches that have already been merged.

So, right now Rouge is a lot slower than the Pygments wrappers. If that can be fixed, there’s no reason left not to switch.

Update 2012-10-31: With @jayferd’s latest speedups, Rouge is almost as fast as Pygments now!

Say something! / Sag was!

No markup, just plain monospace text. / Kein Markup, nur Normschrift-Klartext.