We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 795c342 commit c3daf11Copy full SHA for c3daf11
src/plugins/search/search.js
@@ -166,21 +166,13 @@ export function search(query) {
166
end = postContent.length;
167
}
168
169
- let originKeyword = escapeHtml(postContent)
170
- .substring(indexContent, end)
171
- .match(regEx);
172
- originKeyword = Array.isArray(originKeyword)
173
- ? originKeyword[0]
174
- : keyword;
175
-
176
const matchContent =
177
'...' +
178
escapeHtml(postContent)
179
.substring(start, end)
180
- .replace(
181
- regEx,
182
- `<em class="search-keyword">${originKeyword}</em>`
183
- ) +
+ .replace(regEx, function(word) {
+ return `<em class="search-keyword">${word}</em>`;
+ }) +
184
'...';
185
186
resultStr += matchContent;
0 commit comments