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

@ -21,7 +21,7 @@
"World's Worst Developer", "World's Worst Developer",
"The worst git user to exist", "The worst git user to exist",
"These birds are Pissing me off... I'm the original        Starwalker", "These birds are Pissing me off... I'm the original        Starwalker",
"Make sure to check out <a href='https://univerter.dev'>Univerter!</a>", "Make sure to check out Univerter!",
"Check out <a href='https://asahixp.pages.gay'>Asahi's website! &lt;3</a>", "Check out <a href='https://asahixp.pages.gay'>Asahi's website! &lt;3</a>",
"Check out <a href='https://sylvie.loveh.art/'>Sylvie's website! &lt;3</a>" "Check out <a href='https://sylvie.loveh.art/'>Sylvie's website! &lt;3</a>"
], ],
@ -185,6 +185,7 @@
"color": "lightgray" "color": "lightgray"
}, },
"Univerter": { "Univerter": {
"link": "https://univerter.dev/",
"color": "rgb(200, 175, 255)" "color": "rgb(200, 175, 255)"
}, },
"Ko-fi": { "Ko-fi": {

View file

@ -127,6 +127,7 @@ function highlighter(json, full = true) {
var style = termProps.style || "" var style = termProps.style || ""
var classes = termProps.classes || "" var classes = termProps.classes || ""
var link = termProps.link || ""
if (termProps.color) { if (termProps.color) {
style += `color: ${termProps.color};` style += `color: ${termProps.color};`
@ -155,7 +156,11 @@ function highlighter(json, full = true) {
classes = `class="${classes}"` 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) element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd)
} }