astro/packages/integrations/markdoc/components/Renderer.astro
Ben Holmes f558a9e205
[Markdoc] Fix global asset bleed (#6758)
* wip: propagatedAssets flag per-component

* Propagate in TreeNode

* fix: remove unused inject comment

* feat: make asset propagation an integration opt-in

* fix: remove crawlGraph stopper

* wip: logs to understand what's happening

* SSR mdoc files in dev

* feat: add astroPropagatedAssets flag with vite

* chore: remove console logs

* chore: cleanup hasContentFlag

* fix: set handlePropagation default for legacy integrations

* chore: changeset

* temp: silence acorn type error

* chore: revert pnpm-lock changes

* fix: check correct flag

* We need to handle propagation on markdown because of layouts

* Remove use of renderStyleElement

* Fix heading tests

* Fix merge conflict

* typeof function

* Switch the check

* Add comment on injection detection regexp

---------

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-05-22 13:50:01 -04:00

18 lines
459 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);
---
<ComponentNode treeNode={await createTreeNode(content)} />