Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Fusco <[email protected]>
  • Loading branch information
josephfusco committed Nov 1, 2023
1 parent 80540d6 commit ccc09cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? []) {
Expand All @@ -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 = []

Expand Down

0 comments on commit ccc09cf

Please sign in to comment.