Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method for inserting and returning HTML code using a Twig function is by using the raw filter.

Here's an example:

{% set html = '<p>Hello, world!</p>' %}

{{ html|raw }}

The raw filter will prevent the HTML code from being escaped by Twig, allowing it to be outputted as-is.