UNPKG

docusaurus-numbered-headings

Version:

A Docusaurus plugin that automatically adds numbered headings with support for ISO 2145 and USA Classic numbering conventions

77 lines (63 loc) 1.73 kB
/* Per-document override: force ISO 2145 inside .numbered_headings_iso_2145 */ /* Scoped rules win over the unscoped global rules by class specificity. */ .numbered_headings_iso_2145 h2 { counter-increment: h2counter; counter-reset: h3counter; } .numbered_headings_iso_2145 h2::before { content: counter(h2counter) ". "; } .numbered_headings_iso_2145 h3 { counter-increment: h3counter; counter-reset: h4counter; } .numbered_headings_iso_2145 h3::before { content: counter(h2counter) "." counter(h3counter) ". "; } .numbered_headings_iso_2145 h4 { counter-increment: h4counter; counter-reset: h5counter; } .numbered_headings_iso_2145 h4::before { content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ". "; } .numbered_headings_iso_2145 h5 { counter-increment: h5counter; } .numbered_headings_iso_2145 h5::before { content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) ". "; } /* TOC override via :has() — the right-rail TOC lives outside the wrapped body. */ :root:has(.numbered_headings_iso_2145) ul.table-of-contents > li::before { content: counter(toc-h2) ". "; } :root:has(.numbered_headings_iso_2145) ul.table-of-contents > li > ul > li::before { content: counter(toc-h2) "." counter(toc-h3) ". "; } :root:has(.numbered_headings_iso_2145) ul.table-of-contents > li > ul > li > ul > li::before { content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4) ". "; } :root:has(.numbered_headings_iso_2145) ul.table-of-contents > li > ul > li > ul > li > ul > li::before { content: counter(toc-h2) "." counter(toc-h3) "." counter(toc-h4) "." counter(toc-h5) ". "; }