How to deal with the confliction between PHP-Markdown and MathJax?

I use PHP-Markdown plugin in WordPress. In order to show the formula beautifully, I add some code to use MathJax.

Like this:

Read More
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
    inlineMath: [ ['$','$'], ["\(","\)"] ],
    displayMath: [ ['$$','$$'], ["\[","\]"] ],
    processEscapes: true
    },
    "HTML-CSS": { availableFonts: ["TeX"] }
});
</script>

But something wrong happens. Once my formula contains at least two underlines, the MathJax doesn’t work. Such as $$P_1, P_2$$, and the words between the two underlines will be transformed to italic.

The formula will be transformed by PHP-Markdown first, and it can’t be transformed by MathJax again.

Could you help me?

Related posts

1 comment

  1. I’m not sure this is a real answer, but have you tried PHP-markdown-extra (by the very same Michel Fortin)?

    At least for me (using Mark Jaquith’s markdown-on-save plugin) your example is not a problem.

    But Markdown-extra is not perfect either and I’ve seen some other quirks with respect to emphasis, e.g. Let $(y_n)_{nin omega}$ enumerate ${ x_i: i in bigcup_{nin omega} A_n} $ will trip it up.

Comments are closed.