0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
astro/packages/integrations/markdoc/components/Renderer.astro
Ben Holmes 2a4bb23b2f
Fix missing styles and scripts on document: {render:null} (#7309)
* fix: propagate assets when using document `render: null`

* fix: reverse spread order

* refactor: use README rec in test

* chore: changeset

* chore: revert unneeded changes
2023-06-06 13:40:04 -04:00

24 lines
584 B
Text

---
//! astro-head-inject
import type { Config } from '@markdoc/markdoc';
import Markdoc from '@markdoc/markdoc';
import { ComponentNode, createTreeNode } from './TreeNode.js';
type Props = {
config: Config;
stringifiedAst: string;
};
const { stringifiedAst, config } = Astro.props as Props;
const ast = Markdoc.Ast.fromJSON(stringifiedAst);
const content = Markdoc.transform(ast, config);
---
{
Array.isArray(content) ? (
content.map(async (c) => <ComponentNode treeNode={await createTreeNode(c)} />)
) : (
<ComponentNode treeNode={await createTreeNode(content)} />
)
}