diff options
author | 2023-05-22 13:50:01 -0400 | |
---|---|---|
committer | 2023-05-22 13:50:01 -0400 | |
commit | f558a9e2056fc8f2e2d5814e74f199e398159fc4 (patch) | |
tree | 2dfbd56e3eeb24718238d0254e330ec53de6173a /packages/integrations/markdoc/src/nodes/heading.ts | |
parent | b41963b775149b802eea9e12c5fe266bb9a02944 (diff) | |
download | astro-f558a9e2056fc8f2e2d5814e74f199e398159fc4.tar.gz astro-f558a9e2056fc8f2e2d5814e74f199e398159fc4.tar.zst astro-f558a9e2056fc8f2e2d5814e74f199e398159fc4.zip |
[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>
Diffstat (limited to 'packages/integrations/markdoc/src/nodes/heading.ts')
-rw-r--r-- | packages/integrations/markdoc/src/nodes/heading.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/integrations/markdoc/src/nodes/heading.ts b/packages/integrations/markdoc/src/nodes/heading.ts index 0210e9b90..cb50dd231 100644 --- a/packages/integrations/markdoc/src/nodes/heading.ts +++ b/packages/integrations/markdoc/src/nodes/heading.ts @@ -37,13 +37,14 @@ export const heading: Schema = { const slug = getSlug(attributes, children, config.ctx.headingSlugger); const render = config.nodes?.heading?.render ?? `h${level}`; + const tagProps = // For components, pass down `level` as a prop, // alongside `__collectHeading` for our `headings` collector. // Avoid accidentally rendering `level` as an HTML attribute otherwise! - typeof render === 'function' - ? { ...attributes, id: slug, __collectHeading: true, level } - : { ...attributes, id: slug }; + typeof render === 'string' + ? { ...attributes, id: slug } + : { ...attributes, id: slug, __collectHeading: true, level }; return new Markdoc.Tag(render, tagProps, children); }, |