From 61199f9a2f614d0f4548623b3f55fb2b582c5e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=98=89=E7=90=B3?= <1657199125@qq.com> Date: Thu, 15 Dec 2022 16:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=97=AE=E5=8F=B7=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/js/highlight.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/static/js/highlight.js b/app/static/js/highlight.js index 1003918..55f5852 100644 --- a/app/static/js/highlight.js +++ b/app/static/js/highlight.js @@ -29,6 +29,7 @@ function highLight() { const list = allWords.split(" "); for (let i = 0; i < list.length; ++i) { list[i] = list[i].replace(/(^\s*)|(\s*$)/g, ""); //消除单词两边的空字符 + list[i] = list[i[.replace('?', ""); //消除问号 if (list[i] !== "" && "".indexOf(list[i]) === -1 && "".indexOf(list[i]) === -1) { //将文章中所有出现该单词word的地方改为:" " + word + " "。 正则表达式RegExp()中,"\\s"代表单词前后必须要有空格,以防止只对单词中的部分字符高亮的情况出现。 articleContent = articleContent.replace(new RegExp("\\s"+list[i]+"\\s", "g"), " " + list[i] + " "); -- 2.17.1