How do I get paragraph fields text data without the  tags? I am trying to pass my paragraph field data from Drupal to a component that I have created in Twig. My component echos out data like so:

&lt;p class='my-custom-class'&gt;{{ my_var }}&lt;/p&gt;


In my template file, I am passing data to the component like so:

{% include '@components/my-component-name.twig' with {
   my_var: content.field_my_var_name.0
   ...
} %}


However, when this loads in my browser, what I am getting is:

&lt;p class='my-custom-class'&gt;&lt;/p&gt;
&lt;p&gt;The contents of my var.&lt;/p&gt;


How can I load the contents of my_var into my &lt;p&gt; tag without getting another tag injected?
Does your field contain other &lt;p&gt; tags you want to preserve? Or just this one in the beginning and end? If you don't need to preserve other &lt;p&gt; tags, you could simply use Twig's |striptags filter.

&lt;p class='my-custom-class'&gt;{{ my_var|striptags('&lt;p&gt;') }}&lt;/p&gt;


Or as @Hudri suggested in the comments under your question you may change the field type to something other than formatted text. Or maybe try changing the text format to plain.