diff --git a/config.json b/config.json index 7fef0b5..d2a4555 100644 --- a/config.json +++ b/config.json @@ -76,6 +76,7 @@ "replaceAll": "limegreen", "Godot Engine": "#64B5F6", "javascript": "yellow", - "NodeJS": "limegreen" + "NodeJS": "limegreen", + "Violet": "rgb(200, 150, 255)" } } \ No newline at end of file diff --git a/pageUpdater.js b/pageUpdater.js index 484fcf1..bdbe723 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -39,13 +39,6 @@ function converter(html) { html = html.replaceAll(`{${text}}`, replacers[text]) } - var highTable = Object.keys(highlightedWords) - for (let index = 0; index < highTable.length; index++) { - var term = highTable[index]; - var replacement = `${term}` - html = html.replaceAll(term, replacement) - } - while (html.includes("{PATH_")) { var pagePath = html.substring(html.indexOf("{PATH_")) pagePath = pagePath.substring(6, pagePath.indexOf('}')) @@ -58,6 +51,16 @@ function converter(html) { html = html.replace(stringIndex, pageHTML) } + var bodyHTML = html.substring(html.indexOf("") + 6, html.lastIndexOf("")) + var highTable = Object.keys(highlightedWords) + for (let index = 0; index < highTable.length; index++) { + var term = highTable[index]; + var replacement = `${term}` + bodyHTML = bodyHTML.replaceAll(term, replacement) + } + + html = html.substring(0, html.indexOf("")) + bodyHTML + html.substring(html.indexOf("") + 7) + return html } @@ -66,7 +69,7 @@ module.exports = { var filePath = (req.baseUrl + req.path).trim() - if (filePath.includes(".html") || filePath.includes(".css")) { + if (filePath.includes(".")) { } else { if (filePath.charAt(filePath.length - 1) != '/') {