diff --git a/docs/.vuepress/markdown/createSidebar.js b/docs/.vuepress/markdown/createSidebar.js index 749638a60f5dd024c110dc99c2f66b411242ee78..30629a94d328894490ce65991cd755227e5bdae9 100644 --- a/docs/.vuepress/markdown/createSidebar.js +++ b/docs/.vuepress/markdown/createSidebar.js @@ -16,7 +16,29 @@ function parseBar(file, options) { .parse(fs.readFileSync(file, { encoding: 'utf-8' })) .forEach(token => { if (token.type === 'inline') { - let [_, text, link] = token.content.match(/\[(.+?)\]\((.+?)\)/) || token.content.match(/(.+)/) + let text + let link + let config = {} + token.children.forEach(child => { + switch (child.type) { + case 'text': + text = child.content + break; + case 'link_open': + child.attrs.forEach(attr => { + if (attr[0] === 'href') link = attr[1] + }) + break; + case 'code_inline': + try { + config = JSON.parse(child.content) + } catch (error) { } + break; + + default: + break; + } + }) if (link && !isExternal(link)) { link = path.join('/', link.replace(/\.md\b/, '') @@ -31,7 +53,8 @@ function parseBar(file, options) { contents.push({ level: token.level, [textName]: text, - [linkName]: link + [linkName]: link, + ...config }) } }) diff --git a/docs/uniCloud/_sidebar.md b/docs/uniCloud/_sidebar.md index f1f0d7d8503f00ae3b0fa830ee8fce31340c6a5d..7f96669a0d664eca0b92c75cd7152726637cd37f 100644 --- a/docs/uniCloud/_sidebar.md +++ b/docs/uniCloud/_sidebar.md @@ -48,7 +48,7 @@ * [开发文档](uniCloud/redis.md) * [日志输出](uniCloud/cf-logger.md) * [客户端API](uniCloud/client-sdk.md) -* 重要开源库 +* 重要开源库```{"collapsable": false}``` * [uni-config-center 配置中心](uniCloud/uni-config-center.md) * [uni-starter](uniCloud/uni-starter.md) * [uni-admin](uniCloud/admin.md)