diff --git a/src/services/note_cache.js b/src/services/note_cache.js
index e19cac5f6..f5581ee74 100644
--- a/src/services/note_cache.js
+++ b/src/services/note_cache.js
@@ -38,7 +38,8 @@ async function load() {
function highlightResults(results, allTokens) {
// we remove < signs because they can cause trouble in matching and overwriting existing highlighted chunks
// which would make the resulting HTML string invalid.
- allTokens = allTokens.map(token => token.replace('/ and tag (to avoid matches on single 'b' character)
+ allTokens = allTokens.map(token => token.replace('/[<\{\}]/g', ''));
// sort by the longest so we first highlight longest matches
allTokens.sort((a, b) => a.length > b.length ? -1 : 1);
@@ -51,9 +52,15 @@ function highlightResults(results, allTokens) {
const tokenRegex = new RegExp("(" + utils.escapeRegExp(token) + ")", "gi");
for (const result of results) {
- result.highlighted = result.highlighted.replace(tokenRegex, "$1");
+ result.highlighted = result.highlighted.replace(tokenRegex, "{$1}");
}
}
+
+ for (const result of results) {
+ result.highlighted = result.highlighted
+ .replace(/{/g, "")
+ .replace(/}/g, "");
+ }
}
function findNotes(query) {