Domanda

I've seen that we can syntax highlight dump()ed variables into templates by installing xdebug.

I installed it on Ubuntu with

$ sudo apt-get install php5-xdebug

Trying to dump an array

{{ dump(my_array) }}

I'm now getting the html markup for the highlighted syntax but escaped in the HTML

<pre class='xdebug-var-dump' dir='ltr'>
<b>array</b> <i>(size=2)</i>
  0 <font color='#888a85'>=></font> 
    <b>array</b> <i>(size=11)</i>

Why is it coming escaped ?

È stato utile?

Soluzione

Because Twig escapes markup by default.

In order to see formatted output, use the raw filter

{{ dump(my_array)|raw }}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top