修复导出 github wiki 页内目录无法跳转的问题
This commit is contained in:
parent
d457704f15
commit
be134fd4dc
|
|
@ -22,6 +22,14 @@ module.exports = {
|
|||
.replace(/\[(.*?)]\(assets(.*?)\)/g, '[$1](' + this._githubUrl + 'wiki/images$2)')
|
||||
.replace(/<img(.*?)src="assets(.*?)"/g, '<img$1src="' + this._githubUrl + 'wiki/images$2"')
|
||||
.replace(/<a(.*?)href="assets(.*?)"/g, '<a$1href="' + this._githubUrl + 'wiki/images$2"');
|
||||
//页内目录转换 github 规则
|
||||
file = file.replace(/\[(.*?)]\(#(.*?) "(.*?)"\)/g, function (match, s1, s2, s3) {
|
||||
s2 = s2
|
||||
.replace(/( |%20)/g, '-')
|
||||
.replace(/[^a-zA-Z0-9\u4e00-\u9fa5-_]/g, '')
|
||||
.toLocaleLowerCase();
|
||||
return '[' + s1 + '](#' + s2 + ' "' + s3 + '")';
|
||||
});
|
||||
fs.writeFileSync(pathTo + '/' + fileName[1], file, 'utf-8');
|
||||
},
|
||||
//导出导航、底部签名
|
||||
|
|
|
|||
Loading…
Reference in New Issue