Much more modular "Style" system will allow for more freedom of highlighting effects

This commit is contained in:
bingus_violet 2024-06-18 06:58:17 -05:00
parent 1abe39258f
commit 3cc2844e1c
2 changed files with 11 additions and 2 deletions

View file

@ -164,6 +164,9 @@
"Teto Territory": { "Teto Territory": {
"color": "rgb(255, 100, 100)", "color": "rgb(255, 100, 100)",
"caseInsensitive": true "caseInsensitive": true
},
"Services": {
}, },
"Teto": { "Teto": {
"color": "rgb(255, 100, 100)", "color": "rgb(255, 100, 100)",

View file

@ -173,8 +173,14 @@ function converter(html) {
var spanStart = element.content.substring(0, termIndex).lastIndexOf(" ") var spanStart = element.content.substring(0, termIndex).lastIndexOf(" ")
var startContent = element.content.substring(spanStart, termIndex) var startContent = element.content.substring(spanStart, termIndex)
var replacement = `<span style="color: ${termProps.color}">${startContent + highTable[index] + endContent}</span>` var style = ""
if (termProps.color) {
style += `color: ${termProps.color};`
}
var replacement = `<span style="${style}">${startContent + highTable[index] + endContent}</span>`
element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd) element.content = element.content.substring(0, spanStart) + replacement + element.content.substring(spanEnd)
} }