MCPcopy Create free account
hub / github.com/SyntaxUI/syntaxui / getSections

Function getSections

src/mdx/rehype.mjs:61–77  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

59}
60
61function getSections(node) {
62 let sections = []
63
64 for (let child of node.children ?? []) {
65 if (child.type === 'element' && child.tagName === 'h2') {
66 sections.push(`{
67 title: ${JSON.stringify(toString(child))},
68 id: ${JSON.stringify(child.properties.id)},
69 ...${child.properties.annotation}
70 }`)
71 } else if (child.children) {
72 sections.push(...getSections(child))
73 }
74 }
75
76 return sections
77}
78
79export const rehypePlugins = [
80 mdxAnnotations.rehype,

Callers 1

rehype.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected