escape - Twig Filter
Contao overrides Twig’s default escape filter in order to
support ChunkedText from insert tags and to employ its own escaper strategies.
Double Encoding Prevention
As mention in other sections, Contao uses input encoding by default which would then lead to double encoded output when
rendering content in Twig. Contao overrides this behavior for templates within the @Contao and @Contao_* namespaces.
{# Outputs > i.e. without double encoding #}
{{ '>'|e }}Info
This feature is available in Contao 5.3.19 and later.
However, you can opt into double encoding by passing double_encode = true to the escape filter, which is necessary if
you have HTML code nested in another language.
{# Outputs > i.e. with double encoding #}
{{ '>'|e('html', doubl_encode = true) }}You can find more information in the double encoding section of the Twig architecture article.
ChunkedText Support
Some insert tags might return a ChunkedText instance. The ChunkedText container was created to keep the surrounding
text containing the insert tags separate from the replacements made by the insert tag parser. For example
{{ text|insert_tag_raw|escape('html') }} only escapes the parts that do not come from the replaced insert tags.