mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
22 lines
580 B
Text
22 lines
580 B
Text
---
|
|||
import type { RenderableTreeNode } from '@markdoc/markdoc';
|
|||
import type { AstroInstance } from 'astro';
|
|||
import { validateComponentsProp } from '../dist/utils.js';
|
|||
import { createAstroNode } from './astroNode';
|
|||
import RenderNode from './RenderNode.astro';
|
|||
|
|||
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);
|
|||
}
|
|||
---
|
|||
|
|||
<RenderNode node={createAstroNode(content, components)} />
|