jekyll,

How to escape double curly braces in Jekyll

Aug 28, 2021 · 1 min read · Post a comment

If you are using Jekyll for your blog site or writing some code documentation, you may face the issue with the double curly braces. Jekyll uses liquid tags, so if you are searching how to escape double curly braces in Markdown it will not solve the issue.

Prerequisites

  • Jekyll

Solution

Step 1. You will have to use {% raw %} tag to ensure that the content is unmodified by Jekyll:

 {% raw %}
# some command with {{.json}}
{% endraw %}

Step 2. If you have to put your command into a code block then you need additional code formatting to make your content render as code:

 {% raw %}
# ```bash
# I'm a code block that contains {{.json}}
# ```
{% endraw %}

Conclusion

This tutorial will teach you how to use raw and endraw tags which are the quickest way to escape any special character including the double curly braces in Jekyll. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.