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.
Asked: 2021-10-31 11:00:00 +0000
Seen: 11 times
Last updated: Apr 16 '21