isnowfy / simple

A static blog generator with a single static page
http://isnowfy.github.io/simple/
MIT License
911 stars 661 forks source link

同一篇文章中有多个代码段时着色有问题 #7

Closed z4none closed 10 years ago

z4none commented 10 years ago

修改方法:

    function mdupdate() {
        var converter = new Showdown.converter();
        var tmp = $("#editmd").val();
        // 非贪婪全局替换
        tmp = tmp.replace(/~~~~\{(.*)\}\n([\s\S]*?)~~~~\n/gm, "<pre><code class=\"language-$1\">$2</code></pre>");
        tmp = tmp.replace(/~~~~\n([\s\S]*?)~~~~\n/gm, "<pre><code>$1</code></pre>");
        tmp = converter.makeHtml(tmp);
        $("#edithtml").html(tmp);
        Prism.highlightAll();
        MathJax.Hub.Queue(["Typeset", MathJax.Hub, "edithtml"]);
    }
isnowfy commented 10 years ago

Thanks,https://github.com/isnowfy/simple/issues/3 gh-pages改了,master分支忘记改了。。。