Skip to content

Commit

Permalink
Add note on TOC heading level issue (mmistakes#2902)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug authored and mjt91 committed Jun 23, 2021
1 parent a5fd13c commit 26484b2
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions docs/_docs/10-layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 25 additions & 0 deletions docs/_docs/14-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 26484b2

Please sign in to comment.