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">
MathJax.Hub.Config({
"HTML-CSS": {
imageFont: null,
tex2jax: {inlineMath: [['$','$'], ['\$$','\$$']]}
} ,
skipStartupTypeset: true
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

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

</div>
<!-- Here is the Markdown code -->
</div>

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