diff --git a/src/components/TOC.astro b/src/components/TOC.astro new file mode 100644 index 0000000..0cb59f0 --- /dev/null +++ b/src/components/TOC.astro @@ -0,0 +1,46 @@ +--- +const { headings } = Astro.props; +// 仅提取 h2 和 h3 作为目录 +const toc = headings.filter((h: any) => h.depth === 2 || h.depth === 3); +--- + + +