<p>You can use the <code>raw</code> Twig filter. Try this:</p>

<pre><code>{{ product.name | replace({'®': '&lt;sup&gt;®&lt;/sup&gt;' })|raw }}
</code></pre>

CC BY-SA 4.0
2022-02-15T22:50:47.407Z
Thank you for this!
Anna_MediaGirl
CC BY-SA 3.0
2015-06-12T16:55:08.453Z
2015-06-12T16:55:08.453Z
Aaron Berkowitz
<p>You wanna escape the product name before replacing.</p>

<pre><code>{{ product.name|escape|replace({'®': '&lt;sup&gt;®&lt;/sup&gt;'})|raw }}
</code></pre>

CC BY-SA 3.0
2015-12-15T19:13:37.527Z
2015-12-15T19:13:37.527Z
martin
<p>I have a Plain Text field used for product names. Some of these product names have a Registration Mark or a Trademark, which needs to be formatted within a superscript.</p>

<p>Here is code within my template:</p>

<p><code>{{ product.name | replace({'®': '&lt;sup&gt;®&lt;/sup&gt;' }) }}</code></p>

<p>Which publishes this:</p>

<h3>Acme ABC Widget&lt;sup&gt;®&lt;/sup&gt;</h3>

<p>When what I really want to achieve is this:</p>

<h3>Acme ABC Widget<sup>®</sup></h3>

<p>Does Craft persistently render Plain Text fields as raw text? I was hoping Twig filters could extend the use of Craft's Plain Text field.</p>

<p>My preference is to continue using the Plain Text field to avoid additional formatting breaking the layout.</p>

<templating><field><filter>
How do you wrap text with HTML within a Plain Text field?
# How do you wrap text with HTML within a Plain Text field?

(Asked by: username_0 on 2015-06-12)

I have a Plain Text field used for product names. Some of these product names have a Registration Mark or a Trademark, which needs to be formatted within a superscript.

Here is code within my template:

`{{ product.name | replace({'®': '®' }) }}`

Which publishes this:

### Acme ABC Widget®

When what I really want to achieve is this:

### Acme ABC Widget®

Does Craft persistently render Plain Text fields as raw text? I was hoping Twig filters could extend the use of Craft's Plain Text field.

My preference is to continue using the Plain Text field to avoid additional formatting breaking the layout.

**Tags:** templating, field, filter

---

## 2 answers

### Answer by username_1 on 2015-06-12. Score: 5 | Accepted answer

You can use the raw Twig filter. Try this:
{{ product.name | replace({'®': '®' })|raw }}

> **Comments:**
> **username_2**: Thank you for this!  

---

### Answer by username_3 on 2015-12-15. Score: 3

You wanna escape the product name before replacing.
{{ product.name|escape|replace({'®': '®'})|raw }}


---

