View HTML with TWIG

Asked

Viewed 255 times

2

I’m using TWIG in a project of mine but I’m not able to display a string that has Bold or Italic, it simply ignores. Other HTML commands are normally displayed.

Example:

{{ 'Ao <strong><em><u>contr&aacute;rio do que se acredita</u></em></strong>,<span style="color:#FF0000"> Lorem Ipsum n&atilde;o &eacute; simplesmente um texto rand&ocirc;mico</span>. ' }}

Return: Leaves the whole text with underline and font in red color but Bold and Italic anything.

I’ve tried that too and nothing:

{% autoescape false %}{{ 'Ao <strong><em><u>contr&aacute;rio do que se acredita</u></em></strong>,<span style="color:#FF0000"> Lorem Ipsum n&atilde;o &eacute; simplesmente um texto rand&ocirc;mico</span>. ' }}{% endautoescape %}
  • 1

    How is your CSS?

  • It was empty. Now that you spoke I created the tags and all right. Thank you

  • @Joaonivaldo You can answer your own question to help others with the same question in the future.

1 answer

3

Use

{% autoescape false %}
    Ao <strong><em><u>contr&aacute;rio do que se acredita...
{% endautoescape %}

Or

{{ 'Ao <strong><em><u>contr&aacute;rio do que se acredita...' | raw }}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.