From ccc09cfadfa00ad00847ddf7a81bcfcb64953a7a Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Wed, 1 Nov 2023 12:52:37 -0400 Subject: [PATCH] Add comments Signed-off-by: Joe Fusco --- lib/utils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/utils.js b/lib/utils.js index ed0a7fe..d7a4218 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -2,10 +2,12 @@ import { slugifyWithCounter } from '@sindresorhus/slugify' import { clsx } from 'clsx' import { twMerge } from 'tailwind-merge' +// Merges classes using clsx and tailwind-merge. export function cn(...inputs) { return twMerge(clsx(inputs)) } +// Recursively retrieve text from a node or its children. export function getNodeText(node) { let text = '' for (let child of node.children ?? []) { @@ -18,6 +20,7 @@ export function getNodeText(node) { return text } +// Collects and processes heading nodes (h2, h3) from a list of nodes. export function collectHeadings(nodes, slugify = slugifyWithCounter()) { let sections = []