From 4d6233b4bc39379ff5ac2b1add95f3f54ed75f7c Mon Sep 17 00:00:00 2001 From: Jeroen van den Hout Date: Fri, 17 May 2024 22:59:50 +0200 Subject: [PATCH] check if node only contains text nodes --- packages/rehype-jargon/src/index.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/rehype-jargon/src/index.mjs b/packages/rehype-jargon/src/index.mjs index a8b9f8548ce..411d8e5ea8a 100644 --- a/packages/rehype-jargon/src/index.mjs +++ b/packages/rehype-jargon/src/index.mjs @@ -17,6 +17,7 @@ export default (options) => { const isJargon = (node) => { if ( node.tagName === 'em' && + node.children.every((n) => n.type === 'text') && Object.keys(options.jargon).indexOf(node.children[0].value.toLowerCase()) !== -1 ) return true