Displaying Jekyll liquid in code blocks.
When inside a code block, liquid template elements are still parsed. Which is a problem when blogging about Jekyll. But the {%raw%}
tag comes to the rescue.
In a recent blog post, I wrote about modifying Jekyll templates and encountered a problem.
For example, the markdown
```html
<div>
{{ site.time | date: '%Y-%m-%d' }}
</div>
```
is displayed instead as …
<div>
2022-01-30
</div>
To override this behavious, use the {%raw%}
tag to begin and {%endraw%}
to end.
And so the correct markdown becomes…
```html
{%raw%}
<div>
{{ site.time | date: '%Y-%m-%d' }}
</div>
{%endraw%}
```
Just for fun, here is the even more complex markdown used to correctly format the last code block.