From 157d985a0571ac80621e4def26b7897af63dbead Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Wed, 26 Mar 2025 21:34:18 +0100 Subject: [PATCH] #452 - Fix highlighting with escaped html --- src/tools/text-processing.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/text-processing.ts b/src/tools/text-processing.ts index 5a72c41..4e266bb 100644 --- a/src/tools/text-processing.ts +++ b/src/tools/text-processing.ts @@ -102,6 +102,7 @@ export class TextProcessor { * @param query */ public getMatches(text: string, words: string[], query?: Query): SearchMatch[] { + words = words.map(escapeHTML) const reg = this.stringsToRegex(words) const originalText = text // text = text.toLowerCase().replace(new RegExp(SEPARATORS, 'gu'), ' ') @@ -199,4 +200,3 @@ export function escapeHTML(html: string): string { .replaceAll('"', '"') .replaceAll("'", ''') } -