From b176fefe6f379bdd0fd198846459ca8557d0c8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=A4=9A=E7=9B=8A?= Date: Mon, 17 Jan 2022 14:10:25 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20marked=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E5=85=A8=20alert=20(#3422)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- scripts/md-parser.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e35b62643..3c358c545 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,7 @@ "js-yaml": "^4.1.0", "json5": "^2.2.0", "lint-staged": "^12.1.4", - "marked": "^3.0.4", + "marked": ">=4.0.10", "mkdirp": "^1.0.4", "moment-timezone": "^0.5.33", "path-to-regexp": "^6.2.0", diff --git a/scripts/md-parser.js b/scripts/md-parser.js index fdb24ba46..9c11b12df 100644 --- a/scripts/md-parser.js +++ b/scripts/md-parser.js @@ -197,9 +197,11 @@ module.exports = function (content, file) { } ); - content = marked(content).replace(/

\[\[(\d+)\]\]<\/p>/g, function (_, id) { - return placeholder[id] || ''; - }); + content = marked + .parse(content) + .replace(/

\[\[(\d+)\]\]<\/p>/g, function (_, id) { + return placeholder[id] || ''; + }); content = fis.compile.partial(content, file, 'html'); // + `\n\n

文档内容有误?欢迎大家一起来编写,文档地址:${file.subpath}
`;