# MathJax Not Working Inside HTML Tags

**URL:** https://meta.discourse.org/t/mathjax-not-working-inside-html-tags/112330
**Category:** Support
**Created:** [22 במרץ,‏ 2019,‏ 1:44pm UTC](https://meta.discourse.org/t/mathjax-not-working-inside-html-tags/112330 "2019-03-22T13:44:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Alfarhan\_Zahedi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alfarhan_zahedi/32/141591_2.png) [@Alfarhan\_Zahedi](https://meta.discourse.org/u/Alfarhan_Zahedi)
#### Post date: [22 במרץ,‏ 2019,‏ 1:44pm UTC](https://meta.discourse.org/t/mathjax-not-working-inside-html-tags/112330/1 "2019-03-22T13:44:06Z")

</div>

I have imported my data from OSQA to Discourse, enabled MathJax and rebaked all the posts. Still, the math elements are not ben rendered when used inside HTML tags. (Math element are rendered perfectly when used normally.) Example:  
`<p> $O(n)$ </p>`

But if there’s a newline after the opening tag, the math is rendered as usual.  
Example:

```plaintext
<p>

$O(n)</p>

```

Is this the intended behaviour ? If so, then why ?  
If not, then what am I doing wrong ?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [24 במרץ,‏ 2019,‏ 11:39pm UTC](https://meta.discourse.org/t/mathjax-not-working-inside-html-tags/112330/2 "2019-03-24T23:39:01Z")

</div>

> [@Alfarhan\_Zahedi](#):
>
> Is this the intended behaviour ? If so, then why ?

Yes, this is consistent with commonmark spec, see: [https://spec.commonmark.org/](https://spec.commonmark.org/)

```plaintext
<p> *test* </p>

```

Produces:

\*test\*

Not:

_test_

---

<div class="post-metadata">

### Author: ![Alfarhan\_Zahedi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alfarhan_zahedi/32/141591_2.png) [@Alfarhan\_Zahedi](https://meta.discourse.org/u/Alfarhan_Zahedi)
#### Post date: [25 במרץ,‏ 2019,‏ 6:25am UTC](https://meta.discourse.org/t/mathjax-not-working-inside-html-tags/112330/3 "2019-03-25T06:25:01Z")

</div>

Thanks. Is there a way by which I can override this behaviour (except for entering newlines as described in the first post)?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [25 במרץ,‏ 2019,‏ 6:35am UTC](https://meta.discourse.org/t/mathjax-not-working-inside-html-tags/112330/4 "2019-03-25T06:35:25Z")

</div>

Not really, this is how commonmark works, it would take weeks of work to change this behavior and at the end of the day you would have a non compliant markdown engine.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [20 במאי,‏ 2022,‏ 9:05am UTC](https://meta.discourse.org/t/mathjax-not-working-inside-html-tags/112330/6 "2022-05-20T09:05:34Z")

</div>


