astro/packages/integrations/markdoc/components/Renderer.astro

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
580 B
Text
Raw Normal View History

---
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)} />