hbgamra
hbgamra

Reputation: 879

Avoid HTML entities in a Twig page

I'd like to avoid HTML entities within my web page.

To build a web page in my Symfony application, I used the Twig template engine.

You can see the output :

This is a&nbsp;<strong>preview</strong>&nbsp;of your description, please write one so your clients have an easier time finding you <span style="font-family: Arial, Helvetica, sans; line-height: 14px; text-align: justify;"><br /></span>

I'd like to display the text without HTML entities like &nbsp;. I'd like a Twig filter like PHP's htmlspecialchars_decode().

Upvotes: 1

Views: 955

Answers (1)

abdiel
abdiel

Reputation: 2106

TinyMCE uses that format because it is needed, when you print the output in Twig you can use {{ post_body | raw }} and print as expected.

Upvotes: 2

Related Questions