createTreeNode() — astro Function Reference
Architecture documentation for the createTreeNode() function in TreeNode.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 83ee1580_4119_4dbc_cc9d_e2439d372428["createTreeNode()"] a73f1f20_3c4c_06b9_4480_f1f15d6d68ab["TreeNode.ts"] 83ee1580_4119_4dbc_cc9d_e2439d372428 -->|defined in| a73f1f20_3c4c_06b9_4480_f1f15d6d68ab 7b5d881a_1c3a_f2f6_9445_4ada16c88b10["isPropagatedAssetsModule()"] 83ee1580_4119_4dbc_cc9d_e2439d372428 -->|calls| 7b5d881a_1c3a_f2f6_9445_4ada16c88b10 style 83ee1580_4119_4dbc_cc9d_e2439d372428 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/integrations/markdoc/components/TreeNode.ts lines 121–166
export async function createTreeNode(node: RenderableTreeNodes): Promise<TreeNode> {
if (Array.isArray(node)) {
return Promise.all(node.map((child) => createTreeNode(child)));
} else if (isHTMLString(node)) {
return { type: 'text', content: node as HTMLString };
} else if (typeof node === 'string' || typeof node === 'number') {
return { type: 'text', content: String(node) };
} else if (node === null || typeof node !== 'object' || !Markdoc.Tag.isTag(node)) {
return { type: 'text', content: '' };
}
const children = await Promise.all(node.children.map((child) => createTreeNode(child)));
if (typeof node.name === 'function') {
const component = node.name;
const props = node.attributes;
return {
type: 'component',
component,
props,
children,
};
} else if (isPropagatedAssetsModule(node.name)) {
const { collectedStyles, collectedLinks, collectedScripts } = node.name;
const component = (await node.name.getMod()).default;
const props = node.attributes;
return {
type: 'component',
component,
collectedStyles,
collectedLinks,
collectedScripts,
props,
children,
};
} else {
return {
type: 'element',
tag: node.name,
attributes: node.attributes,
children,
};
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does createTreeNode() do?
createTreeNode() is a function in the astro codebase, defined in packages/integrations/markdoc/components/TreeNode.ts.
Where is createTreeNode() defined?
createTreeNode() is defined in packages/integrations/markdoc/components/TreeNode.ts at line 121.
What does createTreeNode() call?
createTreeNode() calls 1 function(s): isPropagatedAssetsModule.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free