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 <b><i> tags rejected
by Telegram's HTML parser.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jiayuan Zhang 2026-02-14 03:14:41 +08:00
parent 3c911807e1
commit 4c1365ff75

View file

@ -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();