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

Function getSections

apps/baseai.dev/src/mdx/rehype.mjs:104–120  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

102}
103
104export function getSections(node) {
105 let sections = [];
106
107 for (let child of node.children ?? []) {
108 if (child.type === 'element' && child.tagName === 'h2') {
109 sections.push(`{
110 title: ${JSON.stringify(toString(child))},
111 id: ${JSON.stringify(child.properties.id)},
112 ...${child.properties.annotation}
113 }`);
114 } else if (child.children) {
115 sections.push(...getSections(child));
116 }
117 }
118
119 return sections;
120}
121
122export const rehypePlugins = [
123 mdxAnnotations.rehype,

Callers 1

rehype.mjsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected