diff --git a/CHANGELOG.md b/CHANGELOG.md index 233a3076..a165a5d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ ### Enhancements - Add Ukrainian translations. [#4273](https://github.com/mmistakes/minimal-mistakes/pull/4273) -- Add more configuration for Giscus [#4274](https://github.com/mmistakes/minimal-mistakes/pull/4274) +- Add more configuration for Giscus. [#4274](https://github.com/mmistakes/minimal-mistakes/pull/4274) +- Bump jekyll-toc to [v1.2.1](https://github.com/allejo/jekyll-toc/releases/tag/v1.2.1). ### Maintenance @@ -41,7 +42,7 @@ - Add `site.copyright` and `site.copyright_url` config options [#4313](https://github.com/mmistakes/minimal-mistakes/pull/4313) - Lazy-load InstantSearch scripts and stylesheets [#3691](https://github.com/mmistakes/minimal-mistakes/pull/3691) - Improve Finnish translations [#4595](https://github.com/mmistakes/minimal-mistakes/pull/4595) -- Remove redundant downcase from _layouts/categories.html. [#4531](https://github.com/mmistakes/minimal-mistakes/pull/4531) +- Remove redundant downcase from \_layouts/categories.html. [#4531](https://github.com/mmistakes/minimal-mistakes/pull/4531) - Load latest Font Awesome package. [#3765](https://github.com/mmistakes/minimal-mistakes/pull/3765) - Add missing Polish missing UI text strings. [#3969](https://github.com/mmistakes/minimal-mistakes/pull/3969) - Update breadcrumbs conditional to enable/disable them via Front Matter on pages using `layout: single`. [#3096](https://github.com/mmistakes/minimal-mistakes/pull/3096) [#3669](https://github.com/mmistakes/minimal-mistakes/pull/3669) diff --git a/_includes/toc.html b/_includes/toc.html index 8c710072..bc90d08a 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE. {% endcomment %} {% comment %} - Version 1.1.0 + Version 1.2.1 https://github.com/allejo/jekyll-toc "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe @@ -47,6 +47,7 @@ * base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content * anchor_class (string) : '' - add custom class(es) for each anchor element * skip_no_ids (bool) : false - skip headers that do not have an `id` attribute + * flat_toc (bool) : false - when set to true, the TOC will be a single level list Output: An ordered or unordered list representing the table of contents of a markdown block. This snippet will only @@ -69,6 +70,7 @@ {% capture jekyll_toc %}{% endcapture %} {% assign orderedList = include.ordered | default: false %} + {% assign flatToc = include.flat_toc | default: false %} {% assign baseURL = include.base_url | default: include.baseurl | default: '' %} {% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %} {% assign minHeader = include.h_min | default: 1 %} @@ -138,9 +140,9 @@ {% capture listItem %}{{ anchorBody }}{% endcapture %} {% endif %} - {% if currLevel > lastLevel %} + {% if currLevel > lastLevel and flatToc == false %} {% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %} - {% elsif currLevel < lastLevel %} + {% elsif currLevel < lastLevel and flatToc == false %} {% assign repeatCount = lastLevel | minus: currLevel %} {% for i in (1..repeatCount) %} @@ -158,8 +160,13 @@ {% assign firstHeader = false %} {% endfor %} - {% assign repeatCount = minHeader | minus: 1 %} - {% assign repeatCount = lastLevel | minus: repeatCount %} + {% if flatToc == true %} + {% assign repeatCount = 1 %} + {% else %} + {% assign repeatCount = minHeader | minus: 1 %} + {% assign repeatCount = lastLevel | minus: repeatCount %} + {% endif %} + {% for i in (1..repeatCount) %} {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} {% endfor %} @@ -179,4 +186,4 @@ {% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %} {% endif %} {% endif %} -{% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc }} +{% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc -}} diff --git a/docs/_docs/18-history.md b/docs/_docs/18-history.md index 0c0c286e..bdafd200 100644 --- a/docs/_docs/18-history.md +++ b/docs/_docs/18-history.md @@ -5,7 +5,7 @@ permalink: "/docs/history/" excerpt: Change log of enhancements and bug fixes made to the theme. sidebar: nav: docs -last_modified_at: '2024-04-23T13:54:28+08:00' +last_modified_at: '2024-04-23T21:52:19+08:00' toc: false --- @@ -24,7 +24,8 @@ toc: false ### Enhancements - Add Ukrainian translations. [#4273](https://github.com/mmistakes/minimal-mistakes/pull/4273) -- Add more configuration for Giscus [#4274](https://github.com/mmistakes/minimal-mistakes/pull/4274) +- Add more configuration for Giscus. [#4274](https://github.com/mmistakes/minimal-mistakes/pull/4274) +- Bump jekyll-toc to [v1.2.1](https://github.com/allejo/jekyll-toc/releases/tag/v1.2.1). ### Maintenance @@ -56,7 +57,7 @@ toc: false - Add `site.copyright` and `site.copyright_url` config options [#4313](https://github.com/mmistakes/minimal-mistakes/pull/4313) - Lazy-load InstantSearch scripts and stylesheets [#3691](https://github.com/mmistakes/minimal-mistakes/pull/3691) - Improve Finnish translations [#4595](https://github.com/mmistakes/minimal-mistakes/pull/4595) -- Remove redundant downcase from _layouts/categories.html. [#4531](https://github.com/mmistakes/minimal-mistakes/pull/4531) +- Remove redundant downcase from \_layouts/categories.html. [#4531](https://github.com/mmistakes/minimal-mistakes/pull/4531) - Load latest Font Awesome package. [#3765](https://github.com/mmistakes/minimal-mistakes/pull/3765) - Add missing Polish missing UI text strings. [#3969](https://github.com/mmistakes/minimal-mistakes/pull/3969) - Update breadcrumbs conditional to enable/disable them via Front Matter on pages using `layout: single`. [#3096](https://github.com/mmistakes/minimal-mistakes/pull/3096) [#3669](https://github.com/mmistakes/minimal-mistakes/pull/3669)