From 2c96c622e260e95056b5ddd2feab94493e2b91f7 Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Thu, 23 Jun 2022 14:59:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20createSidebar=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/markdown/createSidebar.js | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/.vuepress/markdown/createSidebar.js b/docs/.vuepress/markdown/createSidebar.js index 1edbdd54b..961c16776 100644 --- a/docs/.vuepress/markdown/createSidebar.js +++ b/docs/.vuepress/markdown/createSidebar.js @@ -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(//g, "")) .forEach(token => { if (token.type === 'inline') { let text @@ -37,23 +37,24 @@ function parseBar(file, options) { break; } }) + if (!hasComment) { + if (link && !isExternal(link)) { + link = path.join('/', link.replace(/\.md\b/, '') + .replace(/\bREADME\b/, '') + .replace(/\/index/, '/') + .replace(/\?id=/, '#')) + .replace(/\\/g, '/') - if (link && !isExternal(link)) { - link = path.join('/', link.replace(/\.md\b/, '') - .replace(/\bREADME\b/, '') - .replace(/\/index/, '/') - .replace(/\?id=/, '#')) - .replace(/\\/g, '/') + links.push(link) + } - links.push(link) + contents.push({ + level: token.level, + [textName]: text, + [linkName]: link, + ...config + }) } - - contents.push({ - level: token.level, - [textName]: text, - [linkName]: link, - ...config - }) } }) -- GitLab