From 4472e96c14a051118c9963872930f8b5350c1495 Mon Sep 17 00:00:00 2001 From: kennethcheng Date: Mon, 27 Apr 2026 14:44:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E5=8A=A8=E6=80=81=20TOC=20=E7=9B=AE=E5=BD=95=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TOC.astro | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/components/TOC.astro 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); +--- + + +