Today I learnt rendering liquid code examples in Jekyll 👨💻
In order to write my TIL on ordering Jekyll collections I had to figure out how to render code examples of liquid templates, which is the templating language Jekyll uses.
This is trickier than it sounds as Jekyll see’s the liquid template tags in the code example and tries to render them. This can be avoided by using the highlight liquid
tag followed by the raw
tag after, an example can be seen in the source code for this site.
As Jeykll uses markdown files Github will also try and render them, see example, which is why I’ve linked to the raw file.