# Code Mode How To Display a Code snippet

**URL:** <https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258>\
**Category:** Product Support\
**Tags:** mautic-3\
**Created:** [December 1, 2022, 8:57am UTC](https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258 "2022-12-01T08:57:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JJJ](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jjj/32/8796_2.png) [@JJJ](https://forum.mautic.org/u/JJJ)\
**Post date:** [December 1, 2022, 8:57am UTC](https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258/1 "2022-12-01T08:57:31Z")

</div>

**Your software**  
My Mautic version is: 3.3.4  
My PHP version is: 7.3.30  
My Database type and version is: mysql 5.0.12

**Your problem**  
My problem is:

Mautic Builder (in Code Mode) is automatically replacing:  
`<code>&lt;script async src="https://domain.com"&gt;&lt;/script&gt;</code>`  
to  
`<code><script async src="https://domain.com"></script></code>`  
Which I don’t want… I need to have the `<` and `>` properly displayed inside the `<code></code>` tags.

The question is ; “How do you display a code snippet inside an email”?  
Any special syntax?  
Or, how to prevent Mautic from replacing `&lt;` and `&gt;`?

Thxs

---

<div class="post-metadata">

**Author:** ![leoschuler](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leoschuler/32/4798_2.png) [@leoschuler](https://forum.mautic.org/u/leoschuler)\
**Post date:** [December 1, 2022, 2:08pm UTC](https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258/2 "2022-12-01T14:08:36Z")

</div>

I just tested in my environment and got the same behavior, even with the code mode the code get replaced. - this is definitely a bug

I tried `<code>&amp;lt;p&amp;gt;this is a paragraph&amp;lt;/p&amp;gt;</code>`

so, basically I replace the `&` with `&amp;` which then would make mautic replace the just the ampersand symbol, but then there was an error when sending the e-mail.

I would try to create this e-mail as template, don’t make the snippet editable, just as part of the template because I don’t think the template fixed code would be affected by mautic html parser

---

<div class="post-metadata">

**Author:** ![JJJ](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jjj/32/8796_2.png) [@JJJ](https://forum.mautic.org/u/JJJ)\
**Post date:** [December 2, 2022, 1:06pm UTC](https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258/3 "2022-12-02T13:06:13Z")

</div>

Hey, @leoschuler thanks for following up. If it’s a bug, should I report it somewhere else? Or tag someone? What is the next step? Thxs

---

<div class="post-metadata">

**Author:** ![JJJ](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jjj/32/8796_2.png) [@JJJ](https://forum.mautic.org/u/JJJ)\
**Post date:** [December 5, 2022, 2:10pm UTC](https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258/4 "2022-12-05T14:10:51Z")

</div>

I have udpated Mautic to 4.4.5 and still having the same issue.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [December 7, 2022, 5:34am UTC](https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258/5 "2022-12-07T05:34:51Z")

</div>

Hi, not sure if this is the same thing you want:

```auto

     <pre>
       <pre style="white-space:initial">
        My evil code wont run here
    </pre>
 </pre>

```

---

<div class="post-metadata">

**Author:** ![leoschuler](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leoschuler/32/4798_2.png) [@leoschuler](https://forum.mautic.org/u/leoschuler)\
**Post date:** [December 12, 2022, 12:40pm UTC](https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258/6 "2022-12-12T12:40:54Z")

</div>

sorry for the delayed response, I missed this message.

anyway, I am assuming you’re the one who open this issue: [Code Mode Cannot display html code inside a code tag · Issue #11781 · mautic/mautic · GitHub](https://github.com/mautic/mautic/issues/11781)

---

<div class="post-metadata">

**Author:** ![JJJ](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jjj/32/8796_2.png) [@JJJ](https://forum.mautic.org/u/JJJ)\
**Post date:** [December 12, 2022, 1:13pm UTC](https://forum.mautic.org/t/code-mode-how-to-display-a-code-snippet/26258/7 "2022-12-12T13:13:11Z")

</div>

@joeyk What I’m trying to do is:

```auto
<code>
    <script async src="https://domain.com"></script>
</code>

```

This won’t work and it will break the page.

Also trying the following won’t work:

```auto
<code>
    &lt;script async src="https://domain.com"&gt;&lt;/script&gt;
</code>

```

`&lt;` and `&gt;` will be parsed and replaced by `<` and `>` breaking the code.

@leoschuler Yes!
