Answers.Body: <ol>
  <li><p><strong>Escape single lines as strings:</strong></p>
  
  <pre><code>{{ '{% set foo = "bar" %}' }}
  </code></pre></li>
  <li><p><strong>Use <a href="http://twig.sensiolabs.org/doc/tags/autoescape.html" rel="nofollow"><code>autoescape</code></a> to escape multiple lines, optionally specifying a syntax (see docs):</strong></p>
  
  <pre><code>{% autoescape %}
       {% if foo != "bar" %}
           {% set foo = "bar" %}
       {% endif %}
  {% endautoescape %}
  </code></pre></li>
  <li><p><strong>Use <a href="http://twig.sensiolabs.org/doc/tags/verbatim.html" rel="nofollow"><code>verbatim</code></a> to treat multiple lines as raw text</strong>:</p>
  
  <pre><code>{% verbatim %}
       {% if foo != "bar" %}
           {% set foo = "bar" %}
       {% endif %}   
  {% endverbatim %}
  </code></pre></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-24T17:23:17.243Z
Answers.Text: might want to also add the |raw filter here for completeness as the question does say "prevent it from being processed"?
Answers.UserDisplayName: billythekid
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T13:19:24.053Z
Answers.LastActivityDate: 2014-06-26T21:36:56.647Z
Answers.LastEditDate: 2014-06-26T21:36:56.647Z
Answers.UserDisplayName: nicael
Body: <p>How do I escape Twig code to prevent it from being processed?</p>
  
Tags: <templating><escaping>
Title: How can I escape Twig code to prevent it from being parsed?
ThreadText: # How can I escape Twig code to prevent it from being parsed?
  
  (Asked by: username_0 on 2014-06-15)
  
  How do I escape Twig code to prevent it from being processed?
  
  **Tags:** templating, escaping
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2014-06-15. Score: 12 | Accepted answer
  
  1. **Escape single lines as strings:**
  
     ```
     {{ '{% set foo = "bar" %}' }}
  
     ```
  2. **Use [`autoescape`](http://twig.sensiolabs.org/doc/tags/autoescape.html) to escape multiple lines, optionally specifying a syntax (see docs):**
  
     ```
     {% autoescape %}
          {% if foo != "bar" %}
              {% set foo = "bar" %}
          {% endif %}
     {% endautoescape %}
  
     ```
  3. **Use [`verbatim`](http://twig.sensiolabs.org/doc/tags/verbatim.html) to treat multiple lines as raw text**:
  
     ```
     {% verbatim %}
          {% if foo != "bar" %}
              {% set foo = "bar" %}
          {% endif %}   
     {% endverbatim %}
  
     ```
  
  > **Comments:**
  > **username_1**: might want to also add the |raw filter here for completeness as the question does say "prevent it from being processed"?  
  
  ---
  
  