diff --git a/src/components/widget/TOC.astro b/src/components/widget/TOC.astro index 6f03738e..9549115b 100644 --- a/src/components/widget/TOC.astro +++ b/src/components/widget/TOC.astro @@ -9,26 +9,6 @@ interface Props { let { headings = [] } = Astro.props; -// generate random headings, for testing -// headings = [ -// { text: 'Heading 1', depth: 1, slug: 'heading-1' }, -// { text: 'Heading 2', depth: 2, slug: 'heading-2' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 2', depth: 2, slug: 'heading-2' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 1', depth: 1, slug: 'heading-1' }, -// { text: 'Heading 2', depth: 2, slug: 'heading-2' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 2', depth: 2, slug: 'heading-2' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// { text: 'Heading 3', depth: 3, slug: 'heading-3' }, -// ] - let minDepth = 10; for (const heading of headings) { minDepth = Math.min(minDepth, heading.depth); @@ -49,7 +29,7 @@ let heading1Count = 1; const maxLevel = siteConfig.toc.depth; --- - + {headings.filter((heading) => heading.depth < minDepth + maxLevel).map((heading) =>