diff --git a/tdx-enhanced.js b/tdx-enhanced.js index 20e8c04..e34ce7f 100644 --- a/tdx-enhanced.js +++ b/tdx-enhanced.js @@ -1014,6 +1014,7 @@ } function handleHighlight(type, txt, element) { + let behavior = settings('get','highlightBehavior') var re var style = null @@ -1074,11 +1075,23 @@ //console.log("Apply custom highlight:",txt) let link = element.querySelector("a") - if (re && link) { - let newTitle = re[1] - link.innerText = newTitle - //reset regex - re.lastIndex = 0 + if (behavior==="block") { + if (re && link) { + let newTitle = re[1] + link.innerText = newTitle + //reset regex + re.lastIndex = 0 + } + } else { + if (re && link) { + let text = link.innerText + link.innerText = "" + element = link.appendChild(document.createElement("span")) + element.innerText = text + element.style.lineHeight = "1.4" + //reset regex + re.lastIndex = 0 + } } for (const [attr,val] of Object.entries(style)) { @@ -1391,6 +1404,13 @@ +
+

Highlight Behavior

+ +
+ +
+
@@ -1521,6 +1541,7 @@ data = { colorMode: getColorMode(), linkBehavior: "tabs", + highlightBehavior: "block", customHighlights: [], } }