Escaping

It is sometimes desirable – even necessary – to have Jinja ignore partsit would otherwise handle as variables or blocks. For example, if, withthe default syntax, you want to use {{ as a raw string in a template andnot start a variable, you have to use a trick.

The easiest way to output a literal variable delimiter ({{) is by using avariable expression:

  1. {{ '{{' }}

For bigger sections, it makes sense to mark a block raw. For example, toinclude example Jinja syntax in a template, you can use this snippet:

  1. {% raw %}
  2. <ul>
  3. {% for item in seq %}
  4. <li>{{ item }}</li>
  5. {% endfor %}
  6. </ul>
  7. {% endraw %}