提交 2c96c622 编写于 作者: D DCloud_LXH

feat: createSidebar 支持注释

上级 674de4a4
......@@ -13,7 +13,7 @@ function parseBar(file, options) {
const contents = []
new MarkdownIt()
.parse(fs.readFileSync(file, { encoding: 'utf-8' }))
.parse(fs.readFileSync(file, { encoding: 'utf-8' }).replace(/<!--([\s\S]*?)-->/g, ""))
.forEach(token => {
if (token.type === 'inline') {
let text
......@@ -37,7 +37,7 @@ function parseBar(file, options) {
break;
}
})
if (!hasComment) {
if (link && !isExternal(link)) {
link = path.join('/', link.replace(/\.md\b/, '')
.replace(/\bREADME\b/, '')
......@@ -55,6 +55,7 @@ function parseBar(file, options) {
...config
})
}
}
})
return createMarkdownArray(contents, options.children)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册