feat(shortcode): make in-page ToC collapsable

Useful for long pages with large ToCs and/or on small screens.

Also add `hide_on` and `show_on` options accepting Bootstrap responsive breakpoints.

Useful for setting `{{< toc hide_on="xl" >}}` in conjunction with Book layout which only shows right sidebar ToC on XL screens and above.
This commit is contained in:
George Cushen committed 2021-01-09 20:59:42 +00:00
1 parent a4bc42feb6
commit 468d327370
1 file changed
+4 -2
+4 -2
View File
@@ -1,2 +1,4 @@
<h2>{{ i18n "table_of_contents" }}</h2>
{{ $.Page.TableOfContents }}
<details class="toc-inpage d-print-none {{with .Get "hide_on"}}d-{{.}}-none{{end}} {{with .Get "show_on"}}d-none d-{{.}}-block{{end}}" open>
<summary class="font-weight-bold">{{ i18n "table_of_contents" }}</summary>
{{ $.Page.TableOfContents }}
</details>