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

feat: createSidebar 支持注释

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