Prevent Liquid from interpreting Jinja strings

I recently started blogging about Ansible and some of the posts contained code snippets that have expressions based on the Jinja2 templating engine in them. Jekyll’s Liquid templates, which share some common syntax with Jinja2 templates, use curly brace delimiters like {{ and {% to designate template context variables and template tags (which perform functions in the code).

Issue

Liquid will try to interpolate the Jinja2 template strings and thereby remove strings from the rendered blog post.

Before / markdown source file:

- name: Some action
  file:
    path: "{{item}}"

After / rendered html:

- name: Some action
  file:
    path: ""

Solution

Enclose the section that you want Liquid to ignore in a raw/endraw block:
{% raw %} Strings that I don't want Liquid to touch {% endraw %}

Your code will look like this: