MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / extractSections

Function extractSections

apps/baseai.dev/src/mdx/search.mjs:28–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26}
27
28function 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
47export default function Search(nextConfig = {}) {
48 let cache = new Map()

Callers

nothing calls this directly

Calls 1

excludeObjectExpressionsFunction · 0.85

Tested by

no test coverage detected