I have a variable in my twig template called description.
The variable is a string with an html em tag in it. When I go to the webpage to view the field, the html em tags are stripped out of the string.
I am on a Drupal 8 site and my variable was rendered through
\Drupal::service('renderer')->render()
The twig autoescape
parameter is set to false.
Using the twig debugger, I can see that my markup object includes the html em tags so I know that the problem is how twig is processing the string.
I've read in other posts to use the |raw
tag but this has no effect.
What can I do to make the HTML in my twig variable render properly?
Update: I've included a screenshot of my output from {{ dump(description) }}
{{ description|striptags('<em>')|raw }}