From c21611fb6d45ac0164ea93038dbba368245aecb9 Mon Sep 17 00:00:00 2001 From: Sander Date: Thu, 4 Dec 2025 11:12:02 +0100 Subject: [PATCH] fix: sections for docs --- apps/nextjs-app/lib/sections.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/nextjs-app/lib/sections.ts b/apps/nextjs-app/lib/sections.ts index a568672e..27215c5f 100644 --- a/apps/nextjs-app/lib/sections.ts +++ b/apps/nextjs-app/lib/sections.ts @@ -61,9 +61,7 @@ export type Section = H2Node['attributes'] & { children: Array; }; -export function collectSections(nodes: Array, slugify = slugifyWithCounter()) { - let sections: Array
= []; - +export function collectSections(nodes: Array, slugify = slugifyWithCounter(), sections: Array
= []) { for (let node of nodes) { if (isH2Node(node) || isH3Node(node)) { let title = getNodeText(node); @@ -84,7 +82,7 @@ export function collectSections(nodes: Array, slugify = slugifyWithCounter } } - sections.push(...collectSections(node.children ?? [], slugify)); + collectSections(node.children ?? [], slugify, sections); } return sections;