提供一个页面上导航[TOC]的样式
DEMO:http://dsm.panda-studio.cn:81/showdoc/web/#/1?page_id=2
根据Markdown规范,在页面上增加[TOC],将自动把本页的H1、H2等标签自动生成页面上的导航菜单。Showdoc默认的比较难看,下面是修改后的样式:
正常状态:

鼠标悬停右下角菜单状态:

使用方法: 1、在\showdoc\web目录新建float_toc.css文件,内容如下:
.markdown-toc { position: fixed; bottom: 15px; right: 15px; z-index: 1; } .markdown-toc:before { content:"\e63f"; font-family: element-icons !important; color: #40a9ff; position: absolute; bottom: 0; right: 0; width: 32px; height: 32px; line-height: 32px; text-align: center; background: #fff; border: 1px solid #40a9ff; border-radius: 5px; box-shadow: 0 5px 5px #F2F6FC; } .markdown-toc > .markdown-toc-list { position: relative; z-index: 999; margin: 0; list-style: none;
min-width: 150px;
max-width: 230px;
padding: 5px 0;
background: #fff;
border: 1px solid #DCDFE6;
border-radius: 5px;
box-shadow: 0 5px 5px #F2F6FC;
max-height: 270px;
overflow-y: auto;
transform: scale(0);
margin-right: -230px;
opacity: 0;
visibility: hidden;
transform-origin: bottom right;
transition: .25s ease 0s, margin-right 0s ease .25s;
} .markdown-toc:hover .markdown-toc-list { margin-right: 0px; transform: scale(1); opacity: 1; visibility: visible; transition: .5s cubic-bezier(0.4,1.7,0.6,1), margin-right 0s; }
.markdown-toc li { list-style: none !important; } .markdown-toc li a { display: block; padding: 3px 15px; color: #606266; white-space: nowrap; text-overflow: ellipsis; overflow:hidden; transition: .15s; } .markdown-toc li a:hover { background: #53a8ff; text-decoration: none; color: #fff; transition: 0s; }
.markdown-toc li ul { padding: 0; }
.markdown-toc li li a { padding-left: 30px; }
2、修改\showdoc\web\index.html文件
标签内增加此样式即可,代码如下:Enjoy!
DEMO:http://dsm.panda-studio.cn:81/showdoc/web/#/1?page_id=2
谢谢。 我晚点再移植到官方功能去 conanliuhuan [email protected]于2019年3月18日 周一下午4:47写道:
DEMO:http://dsm.panda-studio.cn:81/showdoc/web/#/1?page_id=2
根据Markdown规范,在页面上增加[TOC],将自动把本页的H1、H2等标签自动生成页面上的导航菜单。Showdoc默认的比较难看,下面是修改后的样式:
正常状态: [image: 图片] https://user-images.githubusercontent.com/26618275/54517074-b364d880-499b-11e9-8ac0-9a0938f8cd59.png
鼠标悬停右下角菜单状态: [image: 图片] https://user-images.githubusercontent.com/26618275/54517120-cb3c5c80-499b-11e9-806e-2d21c2792261.png
使用方法: 1、在\showdoc\web目录新建float_toc.css文件,内容如下:
.markdown-toc { position: fixed; bottom: 15px; right: 15px; z-index: 1; } .markdown-toc:before { content:"\e63f"; font-family: element-icons !important; color: #40a9ff; position: absolute; bottom: 0; right: 0; width: 32px; height: 32px; line-height: 32px; text-align: center; background: #fff; border: 1px solid #40a9ff; border-radius: 5px; box-shadow: 0 5px 5px #F2F6FC; } .markdown-toc > .markdown-toc-list { position: relative; z-index: 999; margin: 0; list-style: none;
min-width: 150px;
max-width: 230px;
padding: 5px 0;
background: #fff;
border: 1px solid #DCDFE6;
border-radius: 5px;
box-shadow: 0 5px 5px #F2F6FC;
max-height: 270px;
overflow-y: auto;
transform: scale(0);
margin-right: -230px;
opacity: 0;
visibility: hidden;
transform-origin: bottom right;
transition: .25s ease 0s, margin-right 0s ease .25s;
} .markdown-toc:hover .markdown-toc-list { margin-right: 0px; transform: scale(1); opacity: 1; visibility: visible; transition: .5s cubic-bezier(0.4,1.7,0.6,1), margin-right 0s; }
.markdown-toc li { list-style: none !important; } .markdown-toc li a { display: block; padding: 3px 15px; color: #606266; white-space: nowrap; text-overflow: ellipsis; overflow:hidden; transition: .15s; } .markdown-toc li a:hover { background: #53a8ff; text-decoration: none; color: #fff; transition: 0s; }
.markdown-toc li ul { padding: 0; }
.markdown-toc li li a { padding-left: 30px; }
2、修改\showdoc\web\index.html文件标签内增加此样式即可,代码如下:
Enjoy!
DEMO:http://dsm.panda-studio.cn:81/showdoc/web/#/1?page_id=2
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/star7th/showdoc/issues/485, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGTroO2VR0gQKaGgtZnIsgZA3uBWZB5ks5vX1KXgaJpZM4b5O82 .
这个功能很棒,很有必要,是想要的,谢谢,尽早更新到官方功能!
已更新进官方功能
页面上增加了[TOC],但是只会在顶部有导航,右侧没有导航哇
已更新进官方功能
是不是你没有更新到github,github里边显示,你最近只更新了composer.json
多看几个历史版本就看到了。我是陆陆续续写的
EchoYu [email protected]于2019年4月9日 周二下午11:36写道:
已更新进官方功能
是不是你没有更新到github,github里边显示,你最近只更新了composer.json
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/star7th/showdoc/issues/485#issuecomment-481304360, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGTrm3IEVQq-ztQtlEHCvFiuQczUuugks5vfLNpgaJpZM4b5O82 .
不对。我好像是忘记编译了。我再改下
Chen Xing [email protected]于2019年4月10日 周三上午12:01写道:
多看几个历史版本就看到了。我是陆陆续续写的
EchoYu [email protected]于2019年4月9日 周二下午11:36写道:
已更新进官方功能
是不是你没有更新到github,github里边显示,你最近只更新了composer.json
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/star7th/showdoc/issues/485#issuecomment-481304360, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGTrm3IEVQq-ztQtlEHCvFiuQczUuugks5vfLNpgaJpZM4b5O82 .
现在好了
Chen Xing [email protected] 于2019年4月10日周三 上午12:03写道:
不对。我好像是忘记编译了。我再改下
Chen Xing [email protected]于2019年4月10日 周三上午12:01写道:
多看几个历史版本就看到了。我是陆陆续续写的
EchoYu [email protected]于2019年4月9日 周二下午11:36写道:
已更新进官方功能
是不是你没有更新到github,github里边显示,你最近只更新了composer.json
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/star7th/showdoc/issues/485#issuecomment-481304360, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGTrm3IEVQq-ztQtlEHCvFiuQczUuugks5vfLNpgaJpZM4b5O82 .
@conanliuhuan 我对你提供的样式做了些封装,详情可见 web_src/src/components/common/Toc.vue
加也上github的形式吧,强上一些样式怪怪的
@elinxer 当有了右下角导航的那种形式,再要原来的目录链接形式,没有太多意义吧,有些多此一举。github它不支持浮动导航,所以它会保留原始的toc样式
@star7th 刚才可能在别的issues回答了。 右下角的导航不是很支持长标题 的内容显示。 原先的TOC样式,可以更完美的显示长标题,及标题尾的一些注释。 右下角导航可以设为一个可选样式比较可取。
不会让用户自定义设置样式。会增加使用复杂度。长度的问题,如果改一下样式就可以解决的话,我有时间看一下。现在是在手机上。
siwen1017 [email protected]于2019年4月13日 周六下午7:24写道:
@star7th https://github.com/star7th 刚才可能在别的issues回答了。 右下角的导航不是很支持长标题 的内容显示。 原先的TOC样式,可以更完美的显示长标题,及标题尾的一些注释。 右下角导航可以设为一个可选样式比较可取。
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/star7th/showdoc/issues/485#issuecomment-482800777, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGTrt1qRwGsEYC-h4eCStgOnhbxsAm8ks5vgb5YgaJpZM4b5O82 .
@siwen1017 思考了一下,觉得保留现状会比较合适。对常标题这种情况,通常点击一下就能看到页面在文中的标题以及内容了。导航的目的是方便自己跳转
已更新进官方功能
现在好了 Chen Xing [email protected] 于2019年4月10日周三 上午12:03写道: … 不对。我好像是忘记编译了。我再改下 Chen Xing @.>于2019年4月10日 周三上午12:01写道: > 多看几个历史版本就看到了。我是陆陆续续写的 > > EchoYu @.>于2019年4月9日 周二下午11:36写道: > >> 已更新进官方功能 >> >> 是不是你没有更新到github,github里边显示,你最近只更新了composer.json >> >> — >> You are receiving this because you commented. >> >> >> Reply to this email directly, view it on GitHub >> <#485 (comment)>, >> or mute the thread >> https://github.com/notifications/unsubscribe-auth/ACGTrm3IEVQq-ztQtlEHCvFiuQczUuugks5vfLNpgaJpZM4b5O82 >> . >> >
真整合到新版本showdoc了吗,我试做了一个文档没看到这么炫的效果

@lanboss 用showdoc试试 TOC标签就知道了。不会采用他的样式,只是小小借用。这种淡蓝色风格不一定适合所有文档的情况。