stephenharris / WP-MarkDown

WP-MarkDown plug-in. Allows Markdown to be enabled in posts, comments and bbPress forums.
http://wordpress.org/extend/plugins/wp-markdown/
112 stars 19 forks source link

support for mathjax.js #65

Closed chengjun closed 8 years ago

chengjun commented 8 years ago

http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML

For those who frequently use latex to write equations, mathjax.js is a very good solution. Just add a line to the head profile of wordpress, it could be supported.

 <script type="text/javascript"
        src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

However, I find a problem with wp-markdown.

$$x = y^2$$ could be well displayed. while the inline equation $E = mc^2$ could not be displayed in the right way. Another way is to to use the \\(equation\\) to express the inline equation. However, if you edit the article more than two times, the \\ would disappear, and the equation would not work. Any way to hack it?

chengjun commented 8 years ago

it seems nobody cares about it. :100:

chengjun commented 8 years ago
<script type="text/x-mathjax-config">
 MathJax.Hub.Config({
   tex2jax: {
     inlineMath: [ ['$','$'], ["\\(","\\)"] ],
     processEscapes: true 
   },
  TeX: {
     equationNumbers: { autoNumber: "AMS" }
  }
 });
</script>
<script type="text/javascript"
            src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!--mathjax end-->  

Put the code into head.php makes everything ok.