Skip to content

Commit 467fdab

Browse files
authored
Merge pull request #262 from gonX/fix-h5-and-h6-support
CSS counter support for h5 and h6
2 parents 7380631 + e2da57b commit 467fdab

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

site/assets/css/site.scss

+17-1
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,32 @@ div.highlighter-rouge {
119119
}
120120
h5 {
121121
font-size: 1.16em;
122+
counter-increment: h5-section;
123+
~ h4 {
124+
counter-reset: h5-section;
125+
}
126+
> span::before {
127+
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section) "."
128+
counter(h5-section) ".";
129+
}
122130
}
123131
h6 {
124132
font-size: 1em;
133+
counter-increment: h6-section;
134+
~ h5 {
135+
counter-reset: h6-section;
136+
}
137+
> span::before {
138+
content: counter(h2-section) "." counter(h3-section) "." counter(h4-section) "."
139+
counter(h5-section) "." counter(h6-section) ".";
140+
}
125141
}
126142

127143
h2, h3 {
128144
@include markdown-header;
129145
}
130146

131-
h2, h3, h4, h5 {
147+
h2, h3, h4, h5, h6 {
132148
// counter display
133149
> span::before {
134150
font-style: italic;

site/assets/js/inject-anchors.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function injectAnchorLinks() {
3939
'.markdown-content h3',
4040
'.markdown-content h4',
4141
'.markdown-content h5',
42+
'.markdown-content h6',
4243
]
4344

4445
anchors.options = {

0 commit comments

Comments
 (0)