mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-23 10:00:52 +02:00
feat(tailwind): port TOC shortcode
This commit is contained in:
parent
9b3512593a
commit
776e5c09c0
5 changed files with 27 additions and 3 deletions
|
@ -84,3 +84,8 @@
|
|||
.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;
|
||||
}
|
||||
|
||||
/* For ToC shortcode, Spoiler shortcode, and direct HTML Details snippets. */
|
||||
details > summary {
|
||||
@apply cursor-pointer font-semibold text-primary-700 dark:text-primary-300;
|
||||
}
|
||||
|
|
2
modules/blox-tailwind/assets/dist/wc.min.css
vendored
2
modules/blox-tailwind/assets/dist/wc.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,6 @@
|
|||
{{/* 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 }}
|
||||
{{- $noop := .Content }}
|
||||
{{ if eq .Type "landing" }}
|
||||
|
|
|
@ -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
|
||||
----------
|
||||
|
|
18
modules/blox-tailwind/layouts/shortcodes/toc.html
Normal file
18
modules/blox-tailwind/layouts/shortcodes/toc.html
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue