我想用降价语言对标题,章节和小节进行编号。所以TOC如下所示:
1. Heading1
2. Heading2
2.1 Section1
2.2 Section2
2.2.1 Subsection1
2.2.2 Subsection2
我正在使用MKDOCS来创建我的静态网页,apython包。是否有可以做到这一点的降价扩展?
我很乐意使用降价语言,欢迎任何帮助和建议。
答案 0 :(得分:0)
编号标头不是HTML可以做的,而是there is standard way to do it with css。
如果尚未完成此声明,请将此声明添加到mkdocs.yml
文件中:
extra_css: [specific.css]
然后将其写在specific.css
目录的docs
文件中(这是建议的CSS代码,逐字记录,因此我让您检查它是否对您有用):
body {
counter-reset : h2;
}
h2 {
counter-reset : h3;
}
h3 {
counter-reset : h4;
}
h4 {
counter-reset : h5;
}
h5 {
counter-reset : h6;
}
article h2:before {
content : counter(h2,decimal) ". ";
counter-increment : h2;
}
article h3:before {
content : counter(h2,decimal) "." counter(h3,decimal) ". ";
counter-increment : h3;
}
article h4:before {
content : counter(h2,decimal) "." counter(h3,decimal) "." counter(h4,decimal) ". ";
counter-increment : h4;
}
article h5:before {
content : counter(h2,decimal) "." counter(h3,decimal) "." counter(h4,decimal) "." counter(h5,decimal) ". ";
counter-increment : h5;
}
article h6:before {
content : counter(h2,decimal) "." counter(h3,decimal) "." counter(h4,decimal) "." counter(h5,decimal) "." counter(h6,decimal) ". ";
counter-increment : h6;
}
h2.nocount:before, h3.nocount:before, h4.nocount:before, h5.nocount:before, h6.nocount:before {
content : "";
counter-increment : none;
}