diff --git a/app/static/js/highlight.js b/app/static/js/highlight.js index 76b4793..2ea9664 100644 --- a/app/static/js/highlight.js +++ b/app/static/js/highlight.js @@ -43,11 +43,12 @@ function highLight() { // 删除所有的mark标签,防止标签发生嵌套 articleContent = articleContent.replace(/<(mark)[^>]*>/gi, ""); articleContent = articleContent.replace(/<(\/mark)[^>]*>/gi, ""); - // 将文章中所有出现该单词word的地方改为:"" + word + ""。 + // 将文章中所有出现该单词word的地方改为:"" + word + ""。 for (let word of totalSet) { - articleContent = articleContent.replace(new RegExp("\\b" + word + "\\b", "g"), "" + word + ""); + articleContent = articleContent.replace(new RegExp("\\b" + word + "\\b", "g"), "" + word + ""); } document.getElementById("article").innerHTML = articleContent; + } function cancelHighlighting() {