* wip: update props api * feat(#139, #309): enable new props api * chore: migrate examples to new props API * docs: update syntax guide for new props API * chore: update examples to new props API * chore: update docs to new Props API * fix: hide __astroInternal from `Astro.props` consumers * chore: remove scratchpad file * chore: fix script error * test: fix failing collection tests * fix: set __astroInternal to `enumerable: false` * chore: add changeset * feat: warn users using old props api
23 lines
515 B
Text
23 lines
515 B
Text
---
|
|
import { renderMarkdown } from '@astrojs/markdown-support';
|
|
|
|
const { content, $scope } = Astro.props;
|
|
let html = null;
|
|
|
|
// This flow is only triggered if a user passes `<Markdown content={content} />`
|
|
if (content) {
|
|
const { content: htmlContent } = await renderMarkdown(content, {
|
|
mode: 'md',
|
|
$: {
|
|
scopedClassName: $scope
|
|
}
|
|
});
|
|
html = htmlContent;
|
|
}
|
|
|
|
/*
|
|
If we have rendered `html` for `content`, render that
|
|
Otherwise, just render the slotted content
|
|
*/
|
|
---
|
|
{html ? html : <slot />}
|