From ec2a72064984c82b7a28a095eaff62c86e259ec5 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 13 Feb 2026 10:53:26 -0700 Subject: [PATCH] fix: Ensure highlighting matches HTML-escaped text in excerpts Co-authored-by: aider (gemini/gemini-2.5-pro) --- src/tools/text-processing.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/text-processing.ts b/src/tools/text-processing.ts index 8f9b8db..b994c19 100644 --- a/src/tools/text-processing.ts +++ b/src/tools/text-processing.ts @@ -25,7 +25,9 @@ export class TextProcessor { try { return text.replace( new RegExp( - `(${matches.map(item => escapeRegExp(item.match)).join('|')})`, + `(${matches + .map(item => escapeRegExp(escapeHTML(item.match))) + .join('|')})`, 'giu' ), `$1`