Skip to content

Commit

Permalink
增加自动编号 (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: zhengshanshan <[email protected]>
  • Loading branch information
shan187 and zhengshanshan authored Jun 5, 2024
1 parent 8aee090 commit 6759e9f
Showing 1 changed file with 119 additions and 1 deletion.
120 changes: 119 additions & 1 deletion docs/source/_static/custom-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,122 @@ nav.bd-links li>a:active, .logo__title:hover, nav.bd-links li>a:hover {
cite {
font-style: normal;
}

body {
counter-reset: h2counter toc-h2counter toctree-l2counter;
}

h2 {
counter-reset: h3counter;
}

h3 {
counter-reset: h4counter;
}

h4 {
counter-reset: h5counter;
}

h5 {
counter-reset: h6counter;
}

h2::before {
counter-increment: h2counter;
content: counter(h2counter) ". ";
}

h3::before {
counter-increment: h3counter;
content: counter(h2counter) "." counter(h3counter) " ";
}

h4::before {
counter-increment: h4counter;
content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) " ";
}

h5::before {
counter-increment: h5counter;
content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) " ";
}

h6::before {
counter-increment: h6counter;
content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) "." counter(h6counter) " ";
}

/* TOC heading counters */
.toc-h2 {
counter-reset: toc-h3counter;
}

.toc-h3 {
counter-reset: toc-h4counter;
}

.toc-h4 {
counter-reset: toc-h5counter;
}

.toc-h5 {
counter-reset: toc-h6counter;
}

.toc-h2 > .nav-link::before {
counter-increment: toc-h2counter;
content: counter(toc-h2counter) ". ";
}

.toc-h3 > .nav-link::before {
counter-increment: toc-h3counter;
content: counter(toc-h2counter) "." counter(toc-h3counter) " ";
}

.toc-h4 > .nav-link::before {
counter-increment: toc-h4counter;
content: counter(toc-h2counter) "." counter(toc-h3counter) "." counter(toc-h4counter) " ";
}

.toc-h5 > .nav-link::before {
counter-increment: toc-h5counter;
content: counter(toc-h2counter) "." counter(toc-h3counter) "." counter(toc-h4counter) "." counter(toc-h5counter) " ";
}

.toc-h6 > .nav-link::before {
counter-increment: toc-h6counter;
content: counter(toc-h2counter) "." counter(toc-h3counter) "." counter(toc-h4counter) "." counter(toc-h5counter) "." counter(toc-h6counter) " ";
}

/* Toctree counters */
.toctree-l2 {
counter-reset: toctree-l3counter;
}

.toctree-l3 {
counter-reset: toctree-l4counter;
}

.toctree-l4 {
counter-reset: toctree-l5counter;
}

.toctree-l2 > a::before {
counter-increment: toctree-l2counter;
content: counter(toctree-l2counter) ". ";
}

.toctree-l3 > a::before {
counter-increment: toctree-l3counter;
content: counter(toctree-l2counter) "." counter(toctree-l3counter) " ";
}

.toctree-l4 > a::before {
counter-increment: toctree-l4counter;
content: counter(toctree-l2counter) "." counter(toctree-l3counter) "." counter(toctree-l4counter) " ";
}

.toctree-l5 > a::before {
counter-increment: toctree-l5counter;
content: counter(toctree-l2counter) "." counter(toctree-l3counter) "." counter(toctree-l4counter) "." counter(toctree-l5counter) " ";
}

0 comments on commit 6759e9f

Please sign in to comment.