()
| 26 | } |
| 27 | |
| 28 | function extractSections() { |
| 29 | return (tree, { sections }) => { |
| 30 | slugify.reset() |
| 31 | |
| 32 | visit(tree, (node) => { |
| 33 | if (node.type === 'heading' || node.type === 'paragraph') { |
| 34 | let content = toString(excludeObjectExpressions(node)) |
| 35 | if (node.type === 'heading' && node.depth <= 2) { |
| 36 | let hash = node.depth === 1 ? null : slugify(content) |
| 37 | sections.push([content, hash, []]) |
| 38 | } else { |
| 39 | sections.at(-1)?.[2].push(content) |
| 40 | } |
| 41 | return SKIP |
| 42 | } |
| 43 | }) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | export default function Search(nextConfig = {}) { |
| 48 | let cache = new Map() |
nothing calls this directly
no test coverage detected