diff --git a/README.md b/README.md index 2019013..d1c38de 100644 --- a/README.md +++ b/README.md @@ -15,135 +15,92 @@ docsify serve ### 文档配置: +```html + + +// Import mermaid + + +``` + ```js +var num = 0; +mermaid.initialize({ startOnLoad: false }); window.$docsify = { - name: 'XXX', - // logo: '/logo1.jpg', - repo: 'https://...', - loadSidebar: true, - alias: { - '/.*/_sidebar.md': '/_sidebar.md' - }, - + nativeEmoji: true, subMaxLevel: 3, - auto2top: true, - // search: 'auto', // 默认值 - markdown: { - renderer: { - text: function (text) { - if (/^==/g.test(text)) { - const escapedText = text.toLowerCase().replace(/^==|==$/g, ''); - return `${escapedText}`; - } - if (/^\%{2}/gm.test(text)) { - return ``; - } - return text; - }, - + code: function(code, lang) { + if (lang === "mermaid") { + return ( + '
' + mermaid.render('mermaid-svg-' + num++, code) + "
" + ); + } + return this.origin.code.apply(this, arguments); + } } - }, - // 完整配置参数 - search0: { // seach: - maxAge: 86400000, // 过期时间,单位毫秒,默认一天 - paths: [], // or 'auto' - placeholder: '搜索', - noData: '找不到结果!', - - - // 搜索标题的最大层级, 1 - 6 - depth: 6, - - - hideOtherSidebarContent: true, // 是否隐藏其他侧边栏内容 - - - // 避免搜索索引冲突 - // 同一域下的多个网站之间 - namespace: 'website-1', - - - // 使用不同的索引作为路径前缀(namespaces) - // 注意:仅适用于 paths: 'auto' 模式 - // - // 初始化索引时,我们从侧边栏查找第一个路径 - // 如果它与列表中的前缀匹配,我们将切换到相应的索引 - // pathNamespaces: ['/zh-cn', '/ru-ru', '/ru-ru/v1'], - - - // 您可以提供一个正则表达式来匹配前缀。在这种情况下, - // 匹配到的字符串将被用来识别索引 - // pathNamespaces: /^(\/(zh-cn|ru-ru))?(\/(v1|v2))?/ - }, - } ``` ### 插件支持 ```html - ... - - - + + + + + ```