Github 官方出了个解析脚本,何必还自己去写
https://github.com/jgm/stmd
下载 js 下面那个 stmd.js 就是
看看这个,php-to-js https://github.com/Danack/PHP-to-Javascript