astro-ghostcms/packages/astro-ghostcms-rendercontent/lib/GhostRender.astro

19 lines
497 B
Plaintext
Raw Normal View History

---
import { createComponentProxy, html } from './utils';
export interface Props {
content?: string;
components?: Record<string, any>;
}
const input = Astro.props.content ?? await Astro.slots.render('default');
if (!input) {
throw new Error('Unable to render <GhostRender> without a content prop or children')
}
// @ts-ignore
const components = createComponentProxy($$result, Astro.props.components);
2024-02-13 16:54:55 +00:00
const content = await html(input, { components });
---
<Fragment set:html={content} />