docusaurus-numbered-headings
Version:
A Docusaurus plugin that automatically adds numbered headings with support for ISO 2145 and USA Classic numbering conventions
81 lines (65 loc) • 1.91 kB
CSS
/* Docusaurus Numbered Headings Plugin Styles - USA Classic Convention */
/* Format: I, A, 1, a (Roman numerals, uppercase letters, digits, lowercase letters) */
/* Starts on h2 because h1 is reserved for the title of the page in Docusaurus. */
h2 {
counter-increment: h2counter;
counter-reset: h3counter;
}
h2::before {
content: counter(h2counter, upper-roman) ". ";
}
h3 {
counter-increment: h3counter;
counter-reset: h4counter;
}
h3::before {
content: counter(h3counter, upper-alpha) ". ";
}
h4 {
counter-increment: h4counter;
counter-reset: h5counter;
}
h4::before {
content: counter(h4counter, decimal) ". ";
}
h5 {
counter-increment: h5counter;
}
h5::before {
content: counter(h5counter, lower-alpha) ". ";
}
/* Table of Contents Numbering - USA Classic Convention */
.table-of-contents > li::before {
content: counter(toc-h2, upper-roman) ". ";
}
.table-of-contents > li > ul > li::before {
content: counter(toc-h3, upper-alpha) ". ";
}
.table-of-contents > li > ul > li > ul > li::before {
content: counter(toc-h4, decimal) ". ";
}
.table-of-contents > li > ul > li > ul > li > ul > li::before {
content: counter(toc-h5, lower-alpha) ". ";
}
/* Disable USA Classic numbering within elements with disable_numbered_headings class */
.disable_numbered_headings h2::before,
.disable_numbered_headings h3::before,
.disable_numbered_headings h4::before,
.disable_numbered_headings h5::before {
content: none ;
}
/* Disable table of contents numbering for USA Classic within disable_numbered_headings */
.disable_numbered_headings .table-of-contents > li::before,
.disable_numbered_headings .table-of-contents > li > ul > li::before,
.disable_numbered_headings .table-of-contents > li > ul > li > ul > li::before,
.disable_numbered_headings
.table-of-contents
> li
> ul
> li
> ul
> li
> ul
> li::before {
content: none ;
}