From 977a95f046ce4b2397bf10d3fa50154bb8eed163 Mon Sep 17 00:00:00 2001 From: iBug Date: Mon, 29 Mar 2021 17:35:29 +0800 Subject: [PATCH] Add note on TOC heading level issue https://github.com/mmistakes/minimal-mistakes/issues/2892#issuecomment-809220952 --- .gitattributes | 14 +++++++++----- docs/_docs/10-layouts.md | 25 +++++++++++++++++++++++++ docs/_docs/14-helpers.md | 25 +++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/.gitattributes b/.gitattributes index a12b5fb4e512..4d536e4abe56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/docs/_docs/10-layouts.md b/docs/_docs/10-layouts.md index 048318823ef0..acb7e098b72f 100644 --- a/docs/_docs/10-layouts.md +++ b/docs/_docs/10-layouts.md @@ -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 %} + +
+ {{ notice-text | markdownify }} +
+ ## Archive layout Essentially the same as `single` with markup adjustments and some modules removed. diff --git a/docs/_docs/14-helpers.md b/docs/_docs/14-helpers.md index 59ac01713f0c..8ae403998b1c 100644 --- a/docs/_docs/14-helpers.md +++ b/docs/_docs/14-helpers.md @@ -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 %} + +
+ {{ notice-text | markdownify }} +
+ ### 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.