From 4c1365ff75750e587c5d396e9595e9be99bc2c4b Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Sat, 14 Feb 2026 03:14:41 +0800 Subject: [PATCH] fix(telegram): strip existing bold markers in table conversion to prevent overlapping HTML tags Table cells already containing **bold** markers got double-wrapped, creating ****text**** which produced overlapping tags rejected by Telegram's HTML parser. Co-Authored-By: Claude Opus 4.6 --- apps/gateway/telegram/telegram-format.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/gateway/telegram/telegram-format.ts b/apps/gateway/telegram/telegram-format.ts index 2b3c305e..c9c11e37 100644 --- a/apps/gateway/telegram/telegram-format.ts +++ b/apps/gateway/telegram/telegram-format.ts @@ -68,8 +68,9 @@ function convertTableBlock(tableLines: string[]): string { if (cells.length === 0) continue; const parts: string[] = []; - // First column as bold title - parts.push(`**${cells[0]}**`); + // First column as bold title — strip existing ** to avoid double-wrapping + const title = cells[0]!.replace(/^\*+|\*+$/g, ""); + parts.push(`**${title}**`); // Remaining columns as "Header: Value" for (let j = 1; j < Math.min(headers.length, cells.length); j++) { const val = cells[j]?.trim();