summaryrefslogtreecommitdiff
path: root/packages/integrations/markdoc/src/heading-ids.ts
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2023-05-31 19:18:07 -0400
committerGravatar GitHub <noreply@github.com> 2023-05-31 19:18:07 -0400
commit339529fc820bac2d514b63198ecf54a1d88c0917 (patch)
tree8b553c0df30c1aa60a037fb915bcf7fdfaea945f /packages/integrations/markdoc/src/heading-ids.ts
parentc4c086e5e70bdd347e1c7601212a04b4f523578e (diff)
downloadastro-339529fc820bac2d514b63198ecf54a1d88c0917.tar.gz
astro-339529fc820bac2d514b63198ecf54a1d88c0917.tar.zst
astro-339529fc820bac2d514b63198ecf54a1d88c0917.zip
Markdoc asset bleed, second try (#7185)
* Revert "revert: markdoc asset bleed (#7178)" This reverts commit 57e65d247f67de61bcc3a585c2254feb61ed2e74. * fix: missing result param on `renderUniqueStylesheet` * test: bundled styles (fails!) * fix: use `type: 'external'` for links * fix: split Astro components from markdoc config * test: style bleed (it fails...) * chore: remove unused util * fix: revert entry change * Stop traversing the graph when you encounter a propagated asset * chore: cleanup unused `entry` prop * refactor: add isPropagatedAssetsMod check * chore: remove unused import * chore: changeset * Normalize path using vite * Update packages/integrations/markdoc/src/index.ts Co-authored-by: Ben Holmes <hey@bholmes.dev> --------- Co-authored-by: Matthew Phillips <matthew@skypack.dev> Co-authored-by: bholmesdev <bholmesdev@gmail.com> Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
Diffstat (limited to 'packages/integrations/markdoc/src/heading-ids.ts')
-rw-r--r--packages/integrations/markdoc/src/heading-ids.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/integrations/markdoc/src/heading-ids.ts b/packages/integrations/markdoc/src/heading-ids.ts
index 5c2f197f2..5e54af9a7 100644
--- a/packages/integrations/markdoc/src/heading-ids.ts
+++ b/packages/integrations/markdoc/src/heading-ids.ts
@@ -47,13 +47,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);
},