Add note on TOC heading level issue (#2902)

https://github.com/mmistakes/minimal-mistakes/issues/2892#issuecomment-809220952
This commit is contained in:
iBug 2021-03-29 20:13:27 +08:00 committed by GitHub
parent 3d3cb58a2e
commit 641ca6f3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 5 deletions

14
.gitattributes vendored
View File

@ -1,6 +1,10 @@
assets/fonts/* linguist-vendored
assets/js/main.min.js linguist-vendored
assets/js/lunr/* linguist-vendored
assets/js/plugins/* linguist-vendored
assets/js/vendor/* linguist-vendored
assets/fonts/* linguist-vendored
assets/js/main.min.js linguist-vendored
assets/js/lunr/* linguist-vendored
assets/js/plugins/* linguist-vendored
assets/js/vendor/* linguist-vendored
_sass/minimal-mistakes/vendor/* linguist-vendored
CHANGELOG.md text merge=union
docs/_docs/18-history.md text merge=union
*.md text

View File

@ -141,6 +141,31 @@ toc_icon: "cog"
---
```
{% capture notice-text %}
**Note:** You need to use contiguous levels of headings for the TOC to generate properly. For example:
```markdown
Good headings:
# Heading
## Heading
### Heading
### Heading
# Heading
## Heading
Bad headings:
# Heading
### Heading (skipped H2)
##### Heading (skipped H4)
```
{% endcapture %}
<div class="notice--warning">
{{ notice-text | markdownify }}
</div>
## Archive layout
Essentially the same as `single` with markup adjustments and some modules removed.

View File

@ -295,6 +295,31 @@ toc_icon: "cog"
**Note:** using both methods will have unintended results. Be sure to remove `{% raw %}{% include toc %}{% endraw %}` placed table of contents from your content when using `toc: true`.
{: .notice--warning }
{% capture notice-text %}
**Note:** You need to use contiguous levels of headings for the TOC to generate properly. For example:
```markdown
Good headings:
# Heading
## Heading
### Heading
### Heading
# Heading
## Heading
Bad headings:
# Heading
### Heading (skipped H2)
##### Heading (skipped H4)
```
{% endcapture %}
<div class="notice--warning">
{{ notice-text | markdownify }}
</div>
### Enabled via `toc` include (deprecated)
To include a Kramdown [auto-generated table of contents](https://kramdown.gettalong.org/converter/html.html#toc) for posts and pages, add the following helper to your content.