Code highlighting in a Jekyll-based blog

It turns out that Jekyll has access to a very powerful code highlighting system pygments. There is a huge number of lexers that define the rules for highlighting for many, many languages.

To use it, you surround your code block like so

1
2
3
4
5
    {% highlight lexer_name %}

        ... code goes here ...

    {% endhighlight %}

lexer_name is a short name for a programming language.

NOTE: To enable syntax highlighting, please set the pygments variable to true in the _config.yml configuration file (see reference).