diff --git a/sa-token-doc/doc/_sidebar.md b/sa-token-doc/doc/_sidebar.md index 3b9f3e56..f0419ef7 100644 --- a/sa-token-doc/doc/_sidebar.md +++ b/sa-token-doc/doc/_sidebar.md @@ -70,7 +70,7 @@ - **其它** - [更新日志](/more/update-log) - - [友情链接](/more/link) + - [框架生态](/more/link) - [推荐公众号](/more/tj-gzh) - [赞助 Sa-Token](/more/sa-token-donate) diff --git a/sa-token-doc/doc/index.html b/sa-token-doc/doc/index.html index bc9105e0..a8c65456 100644 --- a/sa-token-doc/doc/index.html +++ b/sa-token-doc/doc/index.html @@ -92,6 +92,8 @@ }, 1); + + diff --git a/sa-token-doc/doc/lib/docsify-plugin.js b/sa-token-doc/doc/lib/docsify-plugin.js new file mode 100644 index 00000000..a8aaea1c --- /dev/null +++ b/sa-token-doc/doc/lib/docsify-plugin.js @@ -0,0 +1,78 @@ +// 声明 docsify 插件 +var myDocsifyPlugin = function(hook, vm) { + + // 钩子函数:解析之前执行 + hook.beforeEach(function(content) { + try{ + // 功能 1,替换全局变量 + content = content.replace(/\$\{sa.top.version\}/g, window.saTokenTopVersion); + + // 添加 [toc] 标记 + content = content.replace(/\[\[toc\]\]/g, '
'); + + }catch(e){ + // + } + return content; + }); + + // 钩子函数:每次路由切换时,解析内容之后执行 + hook.afterEach(function(html) { + + // 功能 2,文章底部添加仓库地址 + var url = 'https://gitee.com/dromara/sa-token/tree/dev/sa-token-doc/doc/' + vm.route.file; + var url2 = 'https://github.com/dromara/sa-token/tree/dev/sa-token-doc/doc/' + vm.route.file; + var footer = [ + '







', + '' + ].join(''); + return html + footer; + }); + + // 每钩子函数:次路由切换时数据全部加载完成后调用,没有参数。 + hook.doneEach(function() { + + // 功能3,给代码盒子,添加行数样式 + $('pre code').each(function(){ + var lines = $(this).text().split('\n').length; + var $numbering = $('