From 6759e9f8e6158b9a68c472389f4a5c69161e5f5d Mon Sep 17 00:00:00 2001 From: shan187 <1353538136@qq.com> Date: Wed, 5 Jun 2024 14:17:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E7=BC=96?= =?UTF-8?q?=E5=8F=B7=20(#12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: zhengshanshan --- docs/source/_static/custom-theme.css | 120 ++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 1 deletion(-) diff --git a/docs/source/_static/custom-theme.css b/docs/source/_static/custom-theme.css index 02fe5d6..73e8969 100644 --- a/docs/source/_static/custom-theme.css +++ b/docs/source/_static/custom-theme.css @@ -49,4 +49,122 @@ nav.bd-links li>a:active, .logo__title:hover, nav.bd-links li>a:hover { cite { font-style: normal; } - \ No newline at end of file + 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) " "; +} \ No newline at end of file