1.1 KiB
1.1 KiB
markdown 自动显示、增加编号序号
规则
- '#' 一号标题不编号
- 从'##'二号标题开始编号
在哪里改
在markdown的样式文件里改。vscode在:
~/.vscode/extensions/shd101wyy.markdown-preview-enhanced-0.8.13/crossnote/styles/style-template.css
增加以下css
在文末增加以下css
/* 自动增加编号 */
body {counter-reset: section2;}
h2::before {counter-increment: section2;content: counter(section2) ". ";}
h2 {counter-reset: section3;}
h3::before {counter-increment: section3;content: counter(section2) "." counter(section3) " ";}
h3 {counter-reset: section4;}
h4::before {counter-increment: section4;content: counter(section2) "." counter(section3) "." counter(section4) " ";}
h4 {counter-reset: section5;}
h5::before {counter-increment: section5;content: counter(section2) "." counter(section3) "." counter(section4) "." counter(section5) " ";}
h5 {counter-reset: section6;}
h6::before {counter-increment: section6; content: counter(section2) "." counter(section3) "." counter(section4) "." counter(section5) "." counter(section6) " ";}