1

I'm looking to purge all the html from a text field, but leave the line breaks in there. I currently have the following code, which makes line breaks happen, but unfortunately, people can add html to the text field and it will render it.

    {{ user.userAbout|raw }}

Is there any way to do this?

2

Sounds like you're looking for the Twig |striptags filter, which is a wrapper for PHP's strip_tags

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.