diff --git a/lib/rehype-sn.js b/lib/rehype-sn.js index 01519af1..fb35bf4b 100644 --- a/lib/rehype-sn.js +++ b/lib/rehype-sn.js @@ -34,11 +34,12 @@ export default function rehypeSN (options = {}) { properties: { href: `#${headingId}` }, - children: node.children + children: [{ type: 'text', value: nodeText }] } // Replace the heading's children with the new link element node.children = [linkElement] + return [SKIP] } // if img is wrapped in a link, remove the link