From 69bea272ddc9a4f22e7f4f12e492037990087810 Mon Sep 17 00:00:00 2001 From: matevip Date: Fri, 29 May 2026 06:16:19 +0800 Subject: [PATCH] fix(memory-ui): escape `<` in `` sequence as an HTML-like line comment + // and conflate this string literal with the one in stripMarker below. + const userEdited = rawBody.includes('\x3c!-- user-edited') // Strip the hidden marker from the display body — it is metadata, and // since renderMarkdown escapes HTML it would otherwise show as raw text. result.push({ heading, body: stripMarker(rawBody), userEdited }) @@ -107,7 +110,8 @@ function parseSections(content: string): MemorySectionData[] { // Strip the hidden user-edited marker so it never shows up as raw text in the // editor (and never accumulates when a section is edited repeatedly). function stripMarker(body: string): string { - return body.replace(/^[ \t]*[ \t]*$/gm, '').trim() + // `\x3c` escape — same reason as in parseSections above. + return body.replace(/^[ \t]*\x3c!-- user-edited:.*-->[ \t]*$/gm, '').trim() } /**