August 22, 2014

Jekyll Syntax Highlighting

Jekyll and github-pages support syntax highlighting using the pygments library.

To use it:

  1. include pygments aware CSS somewhere in your page template
  2. put highlight code block, referencing the desired syntax

    {% raw %} {% highlight groovy %} class GroovyClass { def cry() { println ‘Whaaa!’ } } {% endhighlight %} {% endraw %}

For instance, the code above should appear like the following:

{% highlight groovy %} class GroovyClass { def cry() { println ‘Whaaa!’ } } {% endhighlight %}

© Brandon Atkinson 2024

Powered by Hugo & Kiss.