blob: 6ae8ee85079cb7b2b2caf71fd01262e8ad8b6d59 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
---
import type { RenderableTreeNode } from '@markdoc/markdoc';
import type { AstroInstance } from 'astro';
import { validateComponentsProp } from '../dist/utils.js';
import { ComponentNode, createTreeNode } from './TreeNode.js';
type Props = {
content: RenderableTreeNode;
components?: Record<string, AstroInstance['default']>;
};
const { content, components } = Astro.props as Props;
// Will throw if components is invalid
if (components) {
validateComponentsProp(components);
}
---
<ComponentNode treeNode={createTreeNode(content, components)} />
|