Skip to content

feat(channels): configurable table rendering for Telegram and WhatsApp#1013

Open
srinis76 wants to merge 1 commit intonextlevelbuilder:devfrom
srinis76:feat/table-mode-channels
Open

feat(channels): configurable table rendering for Telegram and WhatsApp#1013
srinis76 wants to merge 1 commit intonextlevelbuilder:devfrom
srinis76:feat/table-mode-channels

Conversation

@srinis76
Copy link
Copy Markdown

Summary

  • Fixes mobile Telegram formatting: wide tables (>3 cols or long headers) were rendering as raw ASCII <pre> blocks that overflow on narrow screens
  • Introduces a shared internal/channels/tablerender.go with 4 rendering modes: auto, ascii, cards, list, off
  • Configurable per channel instance via table_mode field in instance config JSON
  • WhatsApp gets the same treatment: auto defaults to cards since WhatsApp has no monospace rendering

Default behaviour with no config change (auto mode):

  • Telegram: narrow tables (≤3 cols, ≤36 total chars) → ASCII <pre>; wide tables → card format
  • WhatsApp: all tables → card format

Card format example (5-column bucket list table):

📍 Destination
  Category : Travel
  Priority : High
  Budget : $2,000
  Status : Planned
──────────────────

Test plan

  • go test ./internal/channels/... — all 13 packages pass including 16 new tablerender unit tests
  • Tested live on Telegram: bucket list table (5 cols) renders as cards on mobile
  • All 4 modes verified: auto selects correctly based on table width
  • WhatsApp: auto defaults to cards (no <pre> blocks in WhatsApp)
  • Manual test with table_mode: "ascii" / "list" / "off" via DB config update

🤖 Generated with Claude Code

Mobile users were seeing raw pipe-syntax tables in Telegram because the
previous fixed ASCII renderer wrapped in <pre> blocks, which overflow
on narrow screens.

Introduces a shared table rendering utility (internal/channels/tablerender.go)
with four modes — auto, ascii, cards, list, off — selectable per channel
instance via the table_mode config field.

Default behaviour (auto mode):
- Telegram: narrow tables (≤3 cols, ≤36 total chars) stay as ASCII <pre>;
  wide tables switch to card format (title row + field : value lines).
- WhatsApp: always cards — WhatsApp has no monospace rendering, ASCII
  was never legible there.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant