feat(posts): render heading 4 in TOC (#1023)

This commit is contained in:
Cotes Chung 2023-09-03 20:20:14 +08:00
parent c4af75389a
commit 229c2a2e2b
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
3 changed files with 4 additions and 6 deletions

View file

@ -1,11 +1,11 @@
export function toc() { export function toc() {
if (document.querySelector('#core-wrapper h2,#core-wrapper h3')) { if (document.querySelector('#core-wrapper h2')) {
// see: https://github.com/tscanlin/tocbot#usage // see: https://github.com/tscanlin/tocbot#usage
tocbot.init({ tocbot.init({
tocSelector: '#toc', tocSelector: '#toc',
contentSelector: '.post-content', contentSelector: '.post-content',
ignoreSelector: '[data-toc-skip]', ignoreSelector: '[data-toc-skip]',
headingSelector: 'h2, h3', headingSelector: 'h2, h3, h4',
orderedList: false, orderedList: false,
scrollSmooth: false scrollSmooth: false
}); });

View file

@ -23,7 +23,7 @@ This post is to show Markdown syntax rendering on [**Chirpy**](https://github.co
<h3 data-toc-skip>H3 - heading</h3> <h3 data-toc-skip>H3 - heading</h3>
<h4>H4 - heading</h4> <h4 data-toc-skip>H4 - heading</h4>
## Paragraph ## Paragraph

View file

@ -314,9 +314,7 @@ h1 + .post-meta {
} }
ul { ul {
a { padding-left: 0.75rem;
padding-left: 2rem;
}
} }
} }
} }