# MathJax Not Working Inside HTML Tags

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:

<p>

\$O(n)</p>

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

Yes, this is consistent with commonmark spec, see: https://spec.commonmark.org/

<p> *test* </p>

Produces:

*test*

Not:

test

4 Likes

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

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.

3 Likes