From 393264a6fecb4fa0f6d32df02735d5d0d4bd9b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Fri, 19 Apr 2024 10:51:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/static/js/highlight.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/js/highlight.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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() {