From 7dfdc2ea54c03bda2896fba1d480197cac2f3ac6 Mon Sep 17 00:00:00 2001 From: Ronald Klarenbeek Date: Fri, 27 Feb 2026 15:28:56 +0100 Subject: [PATCH] Fix auto-summary: strip markdown formatting from AI responses --- mzta-background.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mzta-background.js b/mzta-background.js index da73d096..47f192ae 100644 --- a/mzta-background.js +++ b/mzta-background.js @@ -501,7 +501,10 @@ async function _generateSummaryForMessage(headerMessageId, tabId) { await cmd.initWorker(); const aiResponse = await cmd.sendPrompt(); - const cleanedSummary = aiResponse.replace(/\s+/g, ' ').trim(); + let cleanedSummary = aiResponse.replace(/```[\s\S]*?```/g, ''); + cleanedSummary = cleanedSummary.replace(/[\*#_~`]/g, ''); + cleanedSummary = cleanedSummary.replace(/\s+/g, ' ').trim(); + cleanedSummary = cleanedSummary.replace(/^Summary:\s*/i, ''); const summaryData = { summary: cleanedSummary,