Escaping Liquid Syntax
Don’t be like me. Learn from my mistakes. Escape your Liquid.
Liquid is an open-source template language from Shopify that is used by Jekyll.
When posting about how to enable tags in Jekyll on GitHub Pages, I made a funny set of mistakes. First, I forgot to escape my Liquid syntax so that my code samples were rendered by Liquid. As an example, something like this:
``` {{ site.title }} ```
actually renders as And Beyond
.
So then I tried to escape my Liquid like so:
``` {% raw %} //Code with {{ Liquid }} syntax here. ```
But the escape characters rendered in the example!
The final trick is to put your escape characters inside a <pre>
tag but outside the Markdown triple tick ` ``` `.
This works because Markdown gets processed after Liquid.
This whole post has been an exercise in escaping.
Not Created By AI. For more information, please refer to AI Disclaimer.