首页 > 其他分享 >标题、导航、目录添加序号

标题、导航、目录添加序号

时间:2024-10-13 21:59:14浏览次数:1  
标签:md h1 h2 h3 counter 添加 序号 导航 before

在主题文件夹添加base.user.css文件,把下面的内容复制进去。

image
/**************************************
 * Header Counters in Content
 **************************************/

/** initialize css counter */
#write {
    counter-reset: h1
}

h1 {
    counter-reset: h2
}

h2 {
    counter-reset: h3
}

h3 {
    counter-reset: h4
}

h4 {
    counter-reset: h5
}

h5 {
    counter-reset: h6
}

/** put counter result into headings */
#write h1:before {
    counter-increment: h1;
    content: counter(h1) " "
}

#write h2:before {
    counter-increment: h2;
    content: '\e689' counter(h1) "." counter(h2) " "; /** 风车图标 **/
	font-family: "iconfont";
}

#write h3:before,
h3.md-focus.md-heading:before /** override the default style for focused headings */ {
    counter-increment: h3;
    content: counter(h1) "." counter(h2) "." counter(h3) " "
}

#write h4:before,
h4.md-focus.md-heading:before {
    counter-increment: h4;
    content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) " "
}

#write h5:before,
h5.md-focus.md-heading:before {
    counter-increment: h5;
    content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) " "
}

#write h6:before,
h6.md-focus.md-heading:before {
    counter-increment: h6;
    content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) " "
}

/** override the default style for focused headings */
#write>h3.md-focus:before,
#write>h4.md-focus:before,
#write>h5.md-focus:before,
#write>h6.md-focus:before,
h3.md-focus:before,
h4.md-focus:before,
h5.md-focus:before,
h6.md-focus:before {
    color: inherit;
    border: inherit;
    border-radius: inherit;
    position: inherit;
    left:initial;
    float: none;
    top:initial;
    font-size: inherit;
    padding-left: inherit;
    padding-right: inherit;
    vertical-align: inherit;
    font-weight: inherit;
    line-height: inherit;
}




/**************************************
 * Header Counters in TOC
 **************************************/
 
/* No link underlines in TOC */
.md-toc-inner {
    text-decoration: none;
}
 
.md-toc-content {
    counter-reset: h1toc
}
 
.md-toc-h1 {
    margin-left: 0;
    font-size: 1.5rem;
    counter-reset: h2toc
}
 
.md-toc-h2 {
    font-size: 1.1rem;
    margin-left: 2rem;
    counter-reset: h3toc
}
 
.md-toc-h3 {
    margin-left: 3rem;
    font-size: .9rem;
    counter-reset: h4toc
}
 
.md-toc-h4 {
    margin-left: 4rem;
    font-size: .85rem;
    counter-reset: h5toc
}
 
.md-toc-h5 {
    margin-left: 5rem;
    font-size: .8rem;
    counter-reset: h6toc
}
 
.md-toc-h6 {
    margin-left: 6rem;
    font-size: .75rem;
}
 
.md-toc-h1:before {
    color: black;
    counter-increment: h1toc;
    content: counter(h1toc) " " /* <--- delete this dot if not wanted */
}
 
.md-toc-h1 .md-toc-inner {
    margin-left: 0;
}
 
.md-toc-h2:before {
    color: black;
    counter-increment: h2toc;
    content: counter(h1toc) ". " counter(h2toc) " " /* <--- delete this dot if not wanted */
}
 
.md-toc-h2 .md-toc-inner {
    margin-left: 0;
}
 
.md-toc-h3:before {
    color: black;
    counter-increment: h3toc;
    content: counter(h1toc) ". " counter(h2toc) ". " counter(h3toc) " " /* <--- delete this dot if not wanted */
}
 
.md-toc-h3 .md-toc-inner {
    margin-left: 0;
}
 
.md-toc-h4:before {
    color: black;
    counter-increment: h4toc;
    content: counter(h1toc) ". " counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) " " /* <--- delete this dot if not wanted */
}
 
.md-toc-h4 .md-toc-inner {
    margin-left: 0;
}
 
.md-toc-h5:before {
    color: black;
    counter-increment: h5toc;
    content: counter(h1toc) ". " counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) ". " counter(h5toc) " " /* <--- delete this dot if not wanted */
}
 
.md-toc-h5 .md-toc-inner {
    margin-left: 0;
}
 
.md-toc-h6:before {
    color: black;
    counter-increment: h6toc;
    content: counter(h1toc) ". " counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) ". " counter(h5toc) ". " counter(h6toc) " " /* <--- delete this dot if not wanted */
}
 
.md-toc-h6 .md-toc-inner {
    margin-left: 0;
}




/**************************************
 * Header Counters in Sidebar
 **************************************/

.sidebar-content {
    counter-reset: h1
}
 
.outline-h1 {
    counter-reset: h2
}
 
.outline-h2 {
    counter-reset: h3
}
 
.outline-h3 {
    counter-reset: h4
}
 
.outline-h4 {
    counter-reset: h5
}
 
.outline-h5 {
    counter-reset: h6
}
 
.outline-h1>.outline-item>.outline-label:before {
    counter-increment: h1;
    content: counter(h1) " " /* <--- delete this dot if not wanted */
}
 
.outline-h2>.outline-item>.outline-label:before {
    counter-increment: h2;
    content: counter(h1) "." counter(h2) " " /* <--- delete this dot if not wanted */
}
 
.outline-h3>.outline-item>.outline-label:before {
    counter-increment: h3;
    content: counter(h1) "." counter(h2) "." counter(h3) " " /* <--- delete this dot if not wanted */
}
 
.outline-h4>.outline-item>.outline-label:before {
    counter-increment: h4;
    content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) " " /* <--- delete this dot if not wanted */
}
 
.outline-h5>.outline-item>.outline-label:before {
    counter-increment: h5;
    content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) " " /* <--- delete this dot if not wanted */
}
 
.outline-h6>.outline-item>.outline-label:before {
    counter-increment: h6;
    content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) " " /* <--- delete this dot if not wanted */
}

标签:md,h1,h2,h3,counter,添加,序号,导航,before
From: https://www.cnblogs.com/euvio/p/18463104

相关文章

  • 纯flex布局实现传统导航三栏布局
    前情提要flex布局仍然是现在主流的布局方式,但是我实在看不下去csdn上的关于flex的教程了本来想更加细致地讲解flex布局的,可是我比较懒,直接实现一个比较经典的布局吧效果图实现代码 HTML5code:<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8">......
  • 信息时代的导航灯——不可错过的中国顶级新闻网站
    人民网(people.cn)-作为《人民日报》的官方网站,人民网提供权威的新闻报道,覆盖政治、经济、文化、社会等多个领域,是中国最重要的新闻网站之一。新华网(xinhuanet.com)-新华网是新华社的官方网站,提供全面的新闻信息,包括国际、国内、财经、科技等领域的报道,是获取官方新闻的重......
  • 在qemu添加基于ast2600的设备
    公司的设备基于aspeed的ast2600.和ast2600-evt还是有不小差距,需要为了多模拟一些数据,需要添加新machine,修改部分设备.修改文件hw/arm/aspeed.c1.添加新的machinepf12, 基于ast2600-evb,提供一个classinit函数staticconstTypeInfoaspeed_machine_types[]......
  • wpf 下拉框添加选项中删除数据
    需要根据实际需求在按钮的对应事件或者Command中添加逻辑<StyleTargetType="ComboBox"x:Key="DeleteComboBoxStyle"><SetterProperty="ItemContainerStyle"><Setter.Value><!--ComBoxItem--><......
  • Python 列表专题:添加元素
    目录1.Python列表概述1.1什么是列表?1.2列表的基本操作2.添加元素的方法2.1使用 append() 方法2.1.1添加不同类型的元素2.2使用 extend() 方法2.2.1使用字符串扩展列表2.3使用 insert() 方法2.4使用 + 操作符2.5使用 * 操作符3.使用案例3.1......
  • jupyter notebook里添加conda虚拟环境
    情况描述有时clone的项目中包含demo.ipynb文件,需要启动jupyter-notebook运行,此文记录将虚拟环境导入到jupyter中。1.下载并运行jupyter-notebook#在base环境当中安装jupyterpipinstalljupyter#base环境下运行jupyterjupyternotebook#jupyternotebook可选参数2.......
  • Android Studio添加依赖 新版 和 旧版 的添加方式(Gradle添加依赖)(Java)
    旧版的(在线添加)1找文件在项目的build.gradle文件中添加依赖(在下面的节点中添加库格式’组:名字:版本号‘)dependencies{implementation'com.example:library:1.0.0'}implementation‘组:名字:版本号’添加完成之后上方会出现如下图提示(点击现在同步)(Sy......
  • 大华NVR接入ONvif服务,添加数量达到上限
    大华NVR接入ONvif服务,通道比较多无法选择单通道问题:以下是使用谷歌浏览器的画面;以及客服反馈的解决方式 解决步骤: 1.建议更换浏览器尝试,普通的录像机或者摄像机建议使用IE内核的浏览器,比如360浏览器(可以使用兼容模式或者极速模式登录,地址栏后面的图标可以选择登录模式)。......
  • 如果我想在更新商品详情时添加图片,我应该如何修改请求数据?
    在更新商品详情时添加图片,通常需要使用multipart/form-data编码类型来构建请求体,因为这种类型支持文件的上传。以下是如何修改请求数据以包含图片的步骤:一、准备图片文件确保你有要上传的图片文件,并且知道其路径。图片文件将作为请求的一部分发送。二、修改请求头将Conten......
  • tdbox导航Z-Library最新入口官方国内可用网址
    Z-library,被誉为全球范围内最为庞大的数字图书馆之一,其藏书量之丰富令人叹为观止,总计囊括了超过9,826,996册电子书及84,837,646篇学术期刊文章。Z-Library最新的入口(需要梯)https://zh.singlelogin.rehttps://zh.singlelogin.rshttps://z-lib.gshttps://zh.z-lib.gshttps://z......