From cbcd0357cdced6db2014d233c1affdb788a200a7 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Wed, 30 Nov 2016 01:29:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=85=E5=AD=98=E6=BA=A2?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/compile.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/build/compile.js b/build/compile.js index 17e364d610..5dcb7270ce 100644 --- a/build/compile.js +++ b/build/compile.js @@ -32,18 +32,24 @@ marked.setOptions({ renderer: renderer, gfm: true, tables: true, - breaks: true, + breaks: false, pedantic: false, sanitize: false, smartLists: true, smartypants: false, highlight: function (code, lang, callback) { - if(lang){ - return callback('',highlight.highlight(lang,code).value); - }else{ - return callback('',highlight.highlightAuto(code).value); - } + lang = lang?lang:"bash"; + return callback('',highlight.highlight(lang,code).value); } + // highlight: function (code, lang, callback) { + // if(lang){ + // return highlight.highlight(lang,code).value; + // // return callback('',highlight.highlight(lang,code).value); + // }else{ + // return highlight.highlightAuto(code).value; + // // return callback('',highlight.highlightAuto(code).value); + // } + // } }); // 根目录 @@ -84,6 +90,7 @@ CreateDatajs('./.deploy/js/dt.js',function(dt_path,arr){ }) + // 监听实时编译 watch.watchTree(path.join(path.dirname(__dirname),'/'), function (f, curr, prev) { if (typeof f == "object" && prev === null && curr === null) { @@ -159,7 +166,8 @@ function ReadTmpToHTML(from_path,to_path,md_path,des_json){ // 生成到指定目录 var new_to_path = path.join(path.dirname(__dirname),to_path); // 循环创建目录 - mkdirsSync(path.dirname(new_to_path)); + !exists(path.dirname(new_to_path)) && mkdirsSync(path.dirname(new_to_path)); + if(md_path){ var new_md_path = path.join(path.dirname(__dirname),md_path); var README_str = fs.readFileSync(new_md_path);