Skip to content

Commit 289c6cc

Browse files
committed
clean up toc
1 parent eaca373 commit 289c6cc

File tree

4 files changed

+28
-20
lines changed

4 files changed

+28
-20
lines changed

assets/css/style.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,3 @@
4343
@import "components.css";
4444

4545
@variant dark (&:where(.dark, .dark *));
46-
47-
#TableOfContents {
48-
.toc a {
49-
@apply block max-w-full truncate py-1 pl-2 hover:font-medium hover:no-underline;
50-
&[aria-current="true"],
51-
&:hover {
52-
@apply border-l-2 border-x-gray-200 bg-gradient-to-r from-gray-100 font-medium text-black dark:border-l-gray-300 dark:from-gray-200 dark:text-white;
53-
}
54-
&:not([aria-current="true"]) {
55-
@apply text-gray-600 hover:text-black dark:text-gray-700 dark:hover:text-white;
56-
}
57-
}
58-
}

assets/css/utilities.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,16 @@
227227
@utility sub-button {
228228
@apply flex w-full items-start gap-2 rounded-sm px-2 py-2 text-left text-gray-700 transition-colors hover:bg-gray-50 dark:text-gray-100 dark:hover:bg-gray-800;
229229
}
230+
231+
@utility toc {
232+
a {
233+
@apply block max-w-full truncate py-1 pl-2 hover:font-medium hover:no-underline;
234+
&[aria-current="true"],
235+
&:hover {
236+
@apply border-l-2 border-x-gray-200 bg-gradient-to-r from-gray-50 font-medium text-black dark:border-l-gray-300 dark:from-gray-900 dark:text-white;
237+
}
238+
&:not([aria-current="true"]) {
239+
@apply text-gray-600 hover:text-black dark:text-gray-700 dark:hover:text-white;
240+
}
241+
}
242+
}

hugo_stats.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@
133133
"Without-systemd",
134134
"[display:none]",
135135
"absolute",
136+
"active",
137+
"active-toc",
136138
"admonition",
137139
"admonition-content",
138140
"admonition-danger",
@@ -544,6 +546,7 @@
544546
"svg-container",
545547
"syntax-light",
546548
"systemd-networkd",
549+
"tableOfContents",
547550
"text-2xl",
548551
"text-base",
549552
"text-black",

layouts/partials/pagemeta.html

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@
44
- Limits heading levels to a min and max range (`$min` and `$max`).
55
- Wraps the ToC in a `data-pagefind-ignore` container to exclude it from search indexing.
66
- Includes a recursive template (`walkHeadingFragments`) to handle nested headings.
7-
*/ -}}
7+
*/
8+
-}}
89
{{- $toc := false }}
910
{{- with .Fragments }}
1011
{{- $toc = and (ne page.Params.notoc true) .Headings }}
1112
{{- end }}
1213
{{- with $toc }}
1314
<div data-pagefind-ignore class="not-prose">
14-
<div class="text-lg pb-0 lg:pb-2">{{ T "tableOfContents" }}</div>
15-
<nav class="toc">
16-
{{ $root := (index page.Fragments.Headings 0).Headings }}
17-
{{- template "walkHeadingFragments" $root }}
18-
</nav>
15+
<div class="pb-0 text-lg lg:pb-2">
16+
{{ T "tableOfContents" }}
17+
</div>
18+
<nav class="toc">
19+
{{ $root := (index page.Fragments.Headings 0).Headings }}
20+
{{- template "walkHeadingFragments" $root }}
21+
</nav>
1922
</div>
2023
{{- end }}
2124

@@ -26,7 +29,9 @@
2629
{{- range . }}
2730
{{- if and (ge .Level $min) (le .Level $max) }}
2831
<li>
29-
<a class="link lg:no-underline" href="#{{ .ID }}">{{ markdownify .Title }}</a>
32+
<a class="link lg:no-underline" href="#{{ .ID }}"
33+
>{{ markdownify .Title }}</a
34+
>
3035
</li>
3136
{{- end }}
3237
{{- with .Headings }}

0 commit comments

Comments
 (0)