From efd294d53bf7805000c21fa1fc03e7d804f1ef5d Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 22 Mar 2026 21:52:14 +0200 Subject: [PATCH] fix(search): wrong escape of highlighted tokens --- packages/trilium-core/src/services/search/services/search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/trilium-core/src/services/search/services/search.ts b/packages/trilium-core/src/services/search/services/search.ts index d699069c53..72f8ef051d 100644 --- a/packages/trilium-core/src/services/search/services/search.ts +++ b/packages/trilium-core/src/services/search/services/search.ts @@ -691,7 +691,7 @@ function highlightSearchResults(searchResults: SearchResult[], highlightedTokens // which would make the resulting HTML string invalid. // { and } are used for marking and tag (to avoid matches on single 'b' character) // < and > are used for marking and - highlightedTokens = highlightedTokens.map((token) => token.replace("/[<\{\}]/g", "")).filter((token) => !!token?.trim()); + highlightedTokens = highlightedTokens.map((token) => token.replace(/[<>{}]/g, "")).filter((token) => !!token?.trim()); // sort by the longest, so we first highlight the longest matches highlightedTokens.sort((a, b) => (a.length > b.length ? -1 : 1));