一個星數較高的markdown.js
另一個是showdown.js
個人使用覺得showdown.js較好用,原因為,其解析和github的markdown相似
https://github.com/showdownjs/showdown
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.4.2/showdown.min.js"></script>
var converter = new showdown.Converter();
document.getElementById('realArticle').innerHTML =converter.makeHtml(e);
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
<pre class="prettyprint"><code class="language-java">...</code></pre>
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
"xhtml", "xml", "xsl".
<pre class="prettyprint"><code class="language-js">
document.getElementById('testSend').addEventListener('click',function(){
loadhtml('test1.html',function(e){
document.getElementById('test11').innerHTML = e;
execScript('test11');
})
</code></pre>