Fix wacky highlighting stuff
This commit is contained in:
parent
c574a2b48a
commit
3fd257cbe7
1 changed files with 11 additions and 6 deletions
|
@ -156,13 +156,18 @@ function highlighter(json, full = true) {
|
||||||
classes = `class="${classes}"`
|
classes = `class="${classes}"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var replacement = `<span ${style} ${classes} ${link}>${startContent + highTable[index] + endContent}</span>`
|
var stuff = (startContent + highTable[index] + endContent).trim()
|
||||||
|
|
||||||
|
if (!stuff.includes("span")) {
|
||||||
|
var replacement = `<span ${style} ${classes} ${link}>${stuff}</span>`
|
||||||
|
|
||||||
if (link) {
|
if (link) {
|
||||||
replacement = `<a href="${link}">${replacement}</a>`
|
replacement = `<a href="${link}">${replacement}</a>`
|
||||||
}
|
}
|
||||||
|
|
||||||
element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd)
|
element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd)
|
||||||
|
} else {
|
||||||
|
element.content = element.content.replace(termKey, highTable[index])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue