# Twig

To use this language, use the class "language-twig".

## Comments

    {# Some comment
    on multiple lines
    with <html></html>
    inside #}

## Keywords

    {% if foo %} bar {% endif %}
    {% for key, value in arr if value %} {{ do_something() }} {% endfor %}
    {% include 'header.html' %}
    {% include 'template.html' with {'foo': 'bar'} %}

## Operators

    {{ not a }}
    {{ 20 // 7 }}
    {{ b b-and c }}
    {% if phone matches '/^[\\d\\.]+$/' %} ... {% endif %}

## Twig embedded in HTML

    <div>
    {% if foo %}
    	<p>Foo!</p>
    {% else %}
    	<p>Not foo...</p>
    {% endif %}

## Known failures

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. However, Prism dares to be open and honest about them. If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.

### Tag containing Twig is not highlighted

    <div{% if foo %} class="bar"{% endif %}></div>