chore: 更新 marked 修复安全 alert (#3422)

This commit is contained in:
吴多益 2022-01-17 14:10:25 +08:00 committed by GitHub
parent 72f0f52c6c
commit b176fefe6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -154,7 +154,7 @@
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"json5": "^2.2.0", "json5": "^2.2.0",
"lint-staged": "^12.1.4", "lint-staged": "^12.1.4",
"marked": "^3.0.4", "marked": ">=4.0.10",
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"moment-timezone": "^0.5.33", "moment-timezone": "^0.5.33",
"path-to-regexp": "^6.2.0", "path-to-regexp": "^6.2.0",

View File

@ -197,9 +197,11 @@ module.exports = function (content, file) {
} }
); );
content = marked(content).replace(/<p>\[\[(\d+)\]\]<\/p>/g, function (_, id) { content = marked
return placeholder[id] || ''; .parse(content)
}); .replace(/<p>\[\[(\d+)\]\]<\/p>/g, function (_, id) {
return placeholder[id] || '';
});
content = fis.compile.partial(content, file, 'html'); content = fis.compile.partial(content, file, 'html');
// + `\n\n<div class="m-t-lg b-l b-info b-3x wrapper bg-light dk">文档内容有误?欢迎大家一起来编写,文档地址:<i class="fa fa-github"></i><a href="https://github.com/baidu/amis/tree/master${file.subpath}">${file.subpath}</a>。</div>`; // + `\n\n<div class="m-t-lg b-l b-info b-3x wrapper bg-light dk">文档内容有误?欢迎大家一起来编写,文档地址:<i class="fa fa-github"></i><a href="https://github.com/baidu/amis/tree/master${file.subpath}">${file.subpath}</a>。</div>`;