修复内存溢出

This commit is contained in:
jaywcjlove 2016-11-30 01:29:55 +08:00
parent 845ad137fb
commit cbcd0357cd
1 changed files with 15 additions and 7 deletions

View File

@ -32,18 +32,24 @@ marked.setOptions({
renderer: renderer, renderer: renderer,
gfm: true, gfm: true,
tables: true, tables: true,
breaks: true, breaks: false,
pedantic: false, pedantic: false,
sanitize: false, sanitize: false,
smartLists: true, smartLists: true,
smartypants: false, smartypants: false,
highlight: function (code, lang, callback) { highlight: function (code, lang, callback) {
if(lang){ lang = lang?lang:"bash";
return callback('',highlight.highlight(lang,code).value); return callback('',highlight.highlight(lang,code).value);
}else{
return callback('',highlight.highlightAuto(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) { watch.watchTree(path.join(path.dirname(__dirname),'/'), function (f, curr, prev) {
if (typeof f == "object" && prev === null && curr === null) { 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); 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){ if(md_path){
var new_md_path = path.join(path.dirname(__dirname),md_path); var new_md_path = path.join(path.dirname(__dirname),md_path);
var README_str = fs.readFileSync(new_md_path); var README_str = fs.readFileSync(new_md_path);