Answers.Body: <p>Sounds like you're looking for the Twig <a href="https://twig.symfony.com/doc/2.x/filters/striptags.html" rel="nofollow noreferrer">|striptags</a> filter, which is a wrapper for PHP's <a href="https://www.php.net/manual/en/function.strip-tags.php" rel="nofollow noreferrer">strip_tags</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-22T22:56:27.460Z
Answers.LastActivityDate: 2019-04-22T22:56:27.460Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm looking to purge all the <code>html</code> 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 <code>html</code> to the text field and it will render it.</p>
  
  <pre><code>    {{ user.userAbout|raw }}
  </code></pre>
  
  <p>Is there any way to do this?</p>
  
Tags: <templating>
Title: Purge HTML but leave Line Breaks
ThreadText: # Purge HTML but leave Line Breaks
  
  (Asked by: username_0 on 2019-04-18)
  
  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?
  
  **Tags:** templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-22. Score: 2 | Accepted answer
  
  Sounds like you're looking for the Twig [|striptags](https://twig.symfony.com/doc/2.x/filters/striptags.html) filter, which is a wrapper for PHP's [strip\_tags](https://www.php.net/manual/en/function.strip-tags.php)
  
  
  ---
  
  