feat(tailwind): port TOC shortcode

This commit is contained in:
George Cushen 2024-06-01 16:31:32 +01:00
commit 776e5c09c0
5 changed files with 27 additions and 3 deletions

View file

@ -84,3 +84,8 @@
.backlink { .backlink {
@apply text-xs font-medium text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 contrast-more:text-gray-800 contrast-more:dark:text-gray-50; @apply text-xs font-medium text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 contrast-more:text-gray-800 contrast-more:dark:text-gray-50;
} }
/* For ToC shortcode, Spoiler shortcode, and direct HTML Details snippets. */
details > summary {
@apply cursor-pointer font-semibold text-primary-700 dark:text-primary-300;
}

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,6 @@
{{/* Workaround Hugo concurrency issues (e.g. not detecting Page.Store variables) */}} {{/* Workaround Hugo concurrency issues (e.g. not detecting Page.Store variables) */}}
{{/* https://discourse.gohugo.io/t/persisting-data-across-the-build-of-a-site/41114/6 */}} {{/* Use cases: Page.Store use within shortcodes, blox, and backlinks. */}}
{{/* See https://discourse.gohugo.io/t/persisting-data-across-the-build-of-a-site/41114/6 */}}
{{- range $page := site.AllPages }} {{- range $page := site.AllPages }}
{{- $noop := .Content }} {{- $noop := .Content }}
{{ if eq .Type "landing" }} {{ if eq .Type "landing" }}

View file

@ -1,5 +1,5 @@
{{/* {{/*
Docs: https://docs.hugoblox.com/content/writing-markdown-latex/#toggle-list Docs: https://docs.hugoblox.com/reference/markdown/#toggle-lists
Parameters Parameters
---------- ----------

View file

@ -0,0 +1,18 @@
{{/*
Docs: https://docs.hugoblox.com/reference/markdown/#table-of-contents
Parameters
----------
mobile_only : true/false (optional)
Hide TOC on desktop when TOC is shown in right sidebar?
is_open : true/false (optional)
Show the TOC in the open, expanded state?
*/}}
{{ $mobile_only := .Get "mobile_only" | default true }}
{{ $is_open := .Get "is_open" | default false }}
<details class="print:hidden {{with $mobile_only}}xl:hidden{{end}}" {{with $is_open}}open{{end}}>
<summary>{{ i18n "table_of_contents" }}</summary>
<div class="text-sm">
{{ $.Page.TableOfContents }}
</div>
</details>