blob: 6649546fd2fbc6afe259de8ef98dd7f20e9f651e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
---
import { generateToc } from "@/utils/generateToc";
import type { MarkdownHeading } from "astro";
import TOCHeading from "./TOCHeading.astro";
interface Props {
headings: MarkdownHeading[];
}
const { headings } = Astro.props;
const toc = generateToc(headings);
---
<details open class="lg:sticky lg:top-12 lg:order-2 lg:-me-32 lg:basis-64">
<summary class="title hover:marker:text-accent cursor-pointer text-lg">Table of Contents</summary>
<nav class="ms-4 lg:w-full">
<ol class="mt-4">
{toc.map((heading) => <TOCHeading heading={heading} />)}
</ol>
</nav>
</details>
|