1
0
Fork 0

check if node only contains text nodes

This commit is contained in:
Jeroen van den Hout 2024-05-17 22:59:50 +02:00
parent fee235b751
commit 4d6233b4bc
No known key found for this signature in database
GPG key ID: 95B1ECB6FB1D46AC

View file

@ -17,6 +17,7 @@ export default (options) => {
const isJargon = (node) => { const isJargon = (node) => {
if ( if (
node.tagName === 'em' && node.tagName === 'em' &&
node.children.every((n) => n.type === 'text') &&
Object.keys(options.jargon).indexOf(node.children[0].value.toLowerCase()) !== -1 Object.keys(options.jargon).indexOf(node.children[0].value.toLowerCase()) !== -1
) )
return true return true