diff options
author | 2023-03-21 08:17:20 -0400 | |
---|---|---|
committer | 2023-03-21 08:17:20 -0400 | |
commit | 86273b5881cc61ebee11d40280b4c0aba8f4bb2e (patch) | |
tree | e8846e535df75ddecfc83c092bf8cdff5144c5c3 /packages/integrations/markdoc/components/RenderNode.astro | |
parent | 6afb1efea8601cc2bfacec27a8d09c2533fb704a (diff) | |
download | astro-86273b5881cc61ebee11d40280b4c0aba8f4bb2e.tar.gz astro-86273b5881cc61ebee11d40280b4c0aba8f4bb2e.tar.zst astro-86273b5881cc61ebee11d40280b4c0aba8f4bb2e.zip |
[Markdoc] Refactor Renderer internals to use `renderComponent()` (#6607)
* wip: new TreeNode setup
* fix: pass children through `render`
* deps: remove stringify-attributes
* chore: changeset
---------
Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/markdoc/components/RenderNode.astro')
-rw-r--r-- | packages/integrations/markdoc/components/RenderNode.astro | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/packages/integrations/markdoc/components/RenderNode.astro b/packages/integrations/markdoc/components/RenderNode.astro deleted file mode 100644 index a683cd983..000000000 --- a/packages/integrations/markdoc/components/RenderNode.astro +++ /dev/null @@ -1,30 +0,0 @@ ---- -import stringifyAttributes from 'stringify-attributes'; -import type { AstroNode } from './astroNode'; - -type Props = { - node: AstroNode; -}; - -const Node = (Astro.props as Props).node; ---- - -{ - typeof Node === 'string' ? ( - <Fragment set:text={Node} /> - ) : 'component' in Node ? ( - <Node.component {...Node.props}> - {Node.children.map((child) => ( - <Astro.self node={child} /> - ))} - </Node.component> - ) : ( - <Fragment> - <Fragment set:html={`<${Node.tag} ${stringifyAttributes(Node.attributes)}>`} /> - {Node.children.map((child) => ( - <Astro.self node={child} /> - ))} - <Fragment set:html={`</${Node.tag}>`} /> - </Fragment> - ) -} |