Code highlighting allows a reader to quickly skip over the code. Octopress has a syntax highlighting module but I really didn’t like the way it looks and it has a limited set of supported languages. After some Google I came across the following blog post.
I started from the original concept of Kat’s CodeRay plugin. I’ve added a new option so line numbers can be turned on or off. I also cleaned up the style and melted everything together in a nice GitHub plugin. All credits go to the original author of course.
I noticed one problem, CodeRay would number the lines wrong. It would always add an extra number, for no reason at all. Diving into CodeRay I noticed that the count start from 0 but the numbering from 1 (a typical human-to-computer-translation-error). This problem only happens when the plugin is used in Octopress not when I call CodeRay on an external project. I fixed this error with some clever CSS, but some investigation is needed for solving this issue.