diff options
Diffstat (limited to 'packages/integrations/markdoc/src/nodes/heading.ts')
-rw-r--r-- | packages/integrations/markdoc/src/nodes/heading.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/packages/integrations/markdoc/src/nodes/heading.ts b/packages/integrations/markdoc/src/nodes/heading.ts index cb50dd231..0210e9b90 100644 --- a/packages/integrations/markdoc/src/nodes/heading.ts +++ b/packages/integrations/markdoc/src/nodes/heading.ts @@ -37,14 +37,13 @@ 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 === 'string' - ? { ...attributes, id: slug } - : { ...attributes, id: slug, __collectHeading: true, level }; + typeof render === 'function' + ? { ...attributes, id: slug, __collectHeading: true, level } + : { ...attributes, id: slug }; return new Markdoc.Tag(render, tagProps, children); }, |