How to display string that contains HTML in twig template?

Gildas Ross picture Gildas Ross · Dec 2, 2011 · Viewed 156.1k times · Source

How can I display a string that contains HTML tags in twig template?

My PHP variable contains this html and text:

$word = '<b> a word </b>';

When I do this in my twig template:

{{ word }}

I get this:

&lt;b&gt; a word &lt;b&gt;

I want this instead:

<b> a word </b>

Is it possible to get this easily?

Answer

Aurimas Ličkus picture Aurimas Ličkus · Dec 2, 2011