This commit is contained in:
mikusjelly 2016-11-18 23:23:18 +08:00
parent 0eef991a94
commit d470cff8de
1 changed files with 3 additions and 8 deletions

View File

@ -43,12 +43,8 @@ module.exports = {
var text = lines[i].split('## ')[1];
if (text != undefined) {
lineStr = text.replace(/^\s+|\s+$/g, '');
//去除链接
lineStr = lineStr.replace(/\[(.*?)\]\(.*?\)/g, '$1');
//去除所有空格
hashStr = lineStr.replace(/\s+/g, '');
//添加内容
contents += '1. [' + lineStr + '](#' + hashStr + ' "' + lineStr + '")\n';
lineStr = lineStr.replace(/\[(.*?)\]\(.*?\)/g, '$1'); //去除链接
contents += '1. [' + lineStr + '](#' + lineStr + ' "' + lineStr + '")\n';
}
break;
case '###':
@ -56,8 +52,7 @@ module.exports = {
if (text != undefined) {
lineStr = text.replace(/^\s+|\s+$/g, '');
lineStr = lineStr.replace(/\[(.*?)\]\(.*?\)/g, '$1');
hashStr = lineStr.replace(/\s+/g, '');
contents += '\t1. [' + lineStr + '](#' + hashStr + ' "' + lineStr + '")\n';
contents += '\t1. [' + lineStr + '](#' + lineStr + ' "' + lineStr + '")\n';
}
break;
}