How do I get the raw field value in a twig template? myfield is a plain text field. {{ content.field_myfield }} renders the field with HTML markup and the field label.

How do I render the raw value of the field? {{ content.field_myfield.value }} doesn't work.
{{ entity.field_name.value }} to get the true raw value, includes tags and encoding.


Example: {{ node.body.value }} 
result: &lt;p&gt;Batman &amp;amp; Robin&lt;/p&gt;


{{ content.field_name.0 }} to get the raw value minus tags and encoding.


Example: {{ content.body.0 }} 
result: Batman &amp; Robin



  raw
  
  This filter should be avoided whenever possible, particularly if
  you're outputting data that could be user-entered. See this page for
  more information on auto-escape in Drupal 8.
  
  source: Filters - Modifying Variables In Twig Templates
  
  The raw filter marks the value as being "safe", which means that in an
  environment with automatic escaping enabled this variable will not be
  escaped if raw is the last filter applied to it
  
  source: Twig's official docs 






For example, you can use:

{{ node.body.value|striptags }}




{{ paragraph.field_text.value|striptags }}





  The problem with using twig's |striptags is double encoding of html entities,
  not markup, so &amp; becomes &amp;amp; and then &amp;amp;amp; – Berdir