geshi-twig icon indicating copy to clipboard operation
geshi-twig copied to clipboard

Twig syntax recognition for Geshi

Geshi Twig

Geshi language pack for Twig syntax recognition. Two flavors: twig and twightml. While twig recognizes just Twig syntax, twightml recognizes HTML too!

Usage

include_once 'geshi.php';

$source = <<<SOURCE
{% if users|length > 0 %}
    <ul>
        {% for user in users %}
            <li>{{ user.username|e }}</li>
        {% endfor %}
    </ul>
{% endif %}
SOURCE;

$geshi = new GeSHi($source, 'twig');

echo $geshi->parse_code();