更新 app/static/js/highlight.js
parent
00ae770195
commit
4e8ef0a44c
|
@ -42,8 +42,7 @@ function highLight() {
|
|||
let totalSet = new Set();
|
||||
for (let i = 0; i < list.length; ++i) {
|
||||
list[i] = list[i].replace(/(^\W*)|(\W*$)/g, ""); // 消除单词两边的非单词字符
|
||||
list[i] = list[i].replace('|', "");
|
||||
list[i] = list[i].replace('?', "");
|
||||
list[i] = list[i].replace(/[!?()]/g, "");
|
||||
if (list[i] != "" && !totalSet.has(list[i])) {
|
||||
// 返回所有匹配单词的集合, 正则表达式RegExp()中, "\b"匹配一个单词的边界, g 表示全局匹配, i 表示对大小写不敏感。
|
||||
let matches = new Set(articleContent.match(new RegExp("\\b" + list[i] + "\\b", "gi")));
|
||||
|
|
Loading…
Reference in New Issue