Is there a way to display plain text only without any line break or format style. I have an input field using the redactor. I want the result to shows plain text without any formatting for this particular page. How can I modify it?

{% set desc = desc|slice(0,150) %}
{% set _desc = desc|split(' ') %}
{% set __desc = _desc|slice(0,-1) %}
{% set desc = __desc|join(' ') %}


1 Answer 1


If you're trying to remove HTML tags from the output completely, you can use Twig's striptags filter: https://twig.symfony.com/doc/2.x/filters/striptags.html.

If you want to retain the tags but show the output without any styling, you're going to have to handle that with your CSS by negating any of the existing styling you don't want.

  • Thanks. It working now. The reason why I want to remove the HTML tags is that it break my code structure when there is a bold <strong> tag. Not sure what is the reason, so I decided to just output plain text. The result become like this <br... <="" div="">, do you know what is the reason?
    – Lee
    Commented Apr 9, 2020 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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