This post demonstrates both inline code and code blocks with syntax highlighting.
Inline code is done using backticks to create something like this
, which is handy for talking about a specific variable
or a shortExpression++
.
Code blocks are wrapped in the highlight
liquid tag together with a keyword to define the language, like this:
Here’s some JavaScript I borrowed from this StackOverflow post:
And here’s some Python from this tutorial:
The highlighting is done with Rouge and at time of writing [their website] says they support 132 languages. I’m not 100% sure if all those are available in the version bundled within Jekyll. If you have successfully installed this theme, then you can run rougify list
from the Terminal and you should get a list of supported languages. Or check out this wiki page.