Using the two libraries, we can do things in a easier way (^_^)

But if you want to use it in wordpress, you have to first disable the automatic formatting of the Wordpress Editor.

I achieved this goal by installing the plugin TextControl.

Actually, using MathJax independently on multiple posts and/or with markdown.js needs some tricks, as far as I have seen. First you have to be careful about the initial rendering of MathJax. By default it scans your DOM for predefined startup signs and render them, which will completely destruct your Markdown code. So you have to first include:

(Notice the skipStartupTypeset property)

<script src="/js/markdown-js/markdown.js"></script>
<script type="text/x-mathjax-config">
    "HTML-CSS": {
      imageFont: null,
      tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
    } ,
    skipStartupTypeset: true
<script type="text/javascript"


I set two <div>s, one is empty for output, another one with a style="display:none", where I store the Markdown code.

<div id="24ad87ecf_out">
<div id="24ad87ecf" style="display:none">
  <!-- Here is the Markdown code -->

Then we can schedule the page rendering:

function Editor(preview) {
  //The 24ad87ecf_out here is the id of the div you want to show contents in
  var math_24ad87ecf = document.getElementById("24ad87ecf_out");
      MathJax.Hub.Queue(["Typeset", MathJax.Hub, math_24ad87ecf]);
//The 24ad87ecf here is the id of the div you put the markdown code


Notice How This Page is Rendered~

And Look the source of this page for details.

This is the Sample output