@dbushell/hyperless
Advanced tools
Comparing version
{ | ||
"name": "@dbushell/hyperless", | ||
"version": "0.29.0", | ||
"version": "0.30.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -7,4 +7,8 @@ import { Node } from "./html-node.ts"; | ||
* @param node HTML Node | ||
* @param customTags Custom inline tags | ||
*/ | ||
export const mergeInlineNodes = (node: Node): void => { | ||
export const mergeInlineNodes = ( | ||
node: Node, | ||
customTags = new Set<string>(), | ||
): void => { | ||
for (const child of [...node.children]) { | ||
@@ -15,3 +19,3 @@ if (child.type === "OPAQUE") { | ||
// Recursively merge sub-tree first | ||
mergeInlineNodes(child); | ||
mergeInlineNodes(child, customTags); | ||
// Merge this text node into the previous text node | ||
@@ -23,3 +27,3 @@ if (child.type === "TEXT" && child.previous?.type === "TEXT") { | ||
} | ||
if (inlineTags.has(child.tag)) { | ||
if (inlineTags.has(child.tag) || customTags.has(child.tag)) { | ||
// Merge this inline node into previous text node | ||
@@ -26,0 +30,0 @@ if (child.previous?.type === "TEXT") { |
29940
0.4%1005
0.4%