<p>Try using twig's <code>raw</code> filter.</p>

<pre><code>&lt;h3&gt;{{ jobs.jobStatement|replace({'%Job Title%': "&lt;span class='highlight'&gt;" ~ jobs.jobTitle ~ "&lt;/span&gt;" })|raw }}&lt;/h3&gt;
</code></pre>

CC BY-SA 3.0
2015-06-12T17:52:28.683Z
2015-06-12T17:52:28.683Z
Douglas McDonald
<p>I've got a craft field where I have an such as:</p>

<p>Learn more about this great %Job Title% job.</p>

<p>I'm then using Twig Replace to insert the actual entry.jobTitle into the %Job Title% space.</p>

<p>This works great.</p>

<p>But visually, I'd like to highlight the job entry. So I'm wrapping it in a span tag.</p>

<p>Here is an example of the output I want:</p>

<pre><code>&lt;h3&gt;Fantastic opportunity for a &lt;span class="highlight"&gt;Head Chef&lt;/span&gt;&lt;/h3&gt;
</code></pre>

<p>So at the moment I've got it looking like this, pulling in the jobStatement (The line with %Job Title% somewhere in it):</p>

<pre><code>&lt;h3&gt;{{ jobs.jobStatement|replace({'%Job Title%': "&lt;span class='highlight'&gt;" ~ jobs.jobTitle ~ "&lt;/span&gt;" }) }}&lt;/h3&gt;
</code></pre>

<p>Alas, when the template is rendered, it is rendering the entries as text. How can I insert the HTML span tags around the Job Title area?</p>

<p>Any help much appreciated,</p>

<p>Stephen</p>

CC BY-SA 3.0
2015-06-12T17:53:18.587Z
Looks like this might be a duplicate of [this question](http://craftcms.stackexchange.com/questions/10134/how-do-you-wrap-text-with-html-within-a-plain-text-field).
Douglas McDonald
CC BY-SA 3.0
2015-06-12T18:24:38.287Z
Many thanks Douglas, indeed it is, many thanks.
Pathfinder
<templating><replace>
Get a twig | replace to output html rather than the text
# Get a twig | replace to output html rather than the text

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

I've got a craft field where I have an such as:
Learn more about this great %Job Title% job.
I'm then using Twig Replace to insert the actual entry.jobTitle into the %Job Title% space.
This works great.
But visually, I'd like to highlight the job entry. So I'm wrapping it in a span tag.
Here is an example of the output I want:
Fantastic opportunity for a Head Chef

So at the moment I've got it looking like this, pulling in the jobStatement (The line with %Job Title% somewhere in it):
{{ jobs.jobStatement|replace({'%Job Title%': "" ~ jobs.jobTitle ~ "" }) }}

Alas, when the template is rendered, it is rendering the entries as text. How can I insert the HTML span tags around the Job Title area?
Any help much appreciated,
Stephen

**Tags:** templating, replace
> **Comments:**
> **username_1**: Looks like this might be a duplicate of [this question](http://craftcms.stackexchange.com/questions/10134/how-do-you-wrap-text-with-html-within-a-plain-text-field).  
> **username_0**: Many thanks Douglas, indeed it is, many thanks.  

---

## 1 answers

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

Try using twig's raw filter.
{{ jobs.jobStatement|replace({'%Job Title%': "" ~ jobs.jobTitle ~ "" })|raw }}


---

