feat(telegram): convert markdown tables to bullet points (#1495)

Tables render poorly in Telegram (pipes stripped, whitespace collapses).
This adds a 'tableMode' option to markdownToIR that converts tables to
nested bullet points, which render cleanly on mobile.

- Add tableMode: 'flat' | 'bullets' to MarkdownParseOptions
- Track table state during token rendering
- Render tables as bullet points with first column as row labels
- Apply bold styling to row labels for visual hierarchy
- Enable tableMode: 'bullets' for Telegram formatter

Closes #TBD
This commit is contained in:
George Zhang
2026-01-24 02:00:51 +08:00
committed by GitHub
parent bfbeea0f20
commit a1413a011e
3 changed files with 276 additions and 11 deletions

View File

@@ -51,6 +51,7 @@ export function markdownToTelegramHtml(markdown: string): string {
linkify: true,
headingStyle: "none",
blockquotePrefix: "",
tableMode: "bullets",
});
return renderTelegramHtml(ir);
}
@@ -63,6 +64,7 @@ export function markdownToTelegramChunks(
linkify: true,
headingStyle: "none",
blockquotePrefix: "",
tableMode: "bullets",
});
const chunks = chunkMarkdownIR(ir, limit);
return chunks.map((chunk) => ({