Highlights can now have links

This commit is contained in:
bingus_violet 2024-06-26 20:07:02 -05:00
parent 7ad9b489cf
commit 9f137d70ef
2 changed files with 8 additions and 2 deletions

View file

@ -127,6 +127,7 @@ function highlighter(json, full = true) {
var style = termProps.style || ""
var classes = termProps.classes || ""
var link = termProps.link || ""
if (termProps.color) {
style += `color: ${termProps.color};`
@ -155,7 +156,11 @@ function highlighter(json, full = true) {
classes = `class="${classes}"`
}
var replacement = `<span ${style} ${classes}>${startContent + highTable[index] + endContent}</span>`
var replacement = `<span ${style} ${classes} ${link}>${startContent + highTable[index] + endContent}</span>`
if (link) {
replacement = `<a href="${link}">${replacement}</a>`
}
element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd)
}