Skip to content

feat(render): render Slack table blocks as GFM tables - #136

Open
jprichardson wants to merge 1 commit into
stablyai:mainfrom
jprichardson:feat/render-table-blocks
Open

feat(render): render Slack table blocks as GFM tables#136
jprichardson wants to merge 1 commit into
stablyai:mainfrom
jprichardson:feat/render-table-blocks

Conversation

@jprichardson

Copy link
Copy Markdown
Contributor

What

Tables built or pasted in the Slack composer arrive as table blocks — directly in blocks, or nested inside attachment.blocks where the attachment's fallback text is just [no preview available]. message get / message list previously dropped them from rendered content.

This renders table blocks as GitHub-flavored tables:

  • cells are rich_text blocks or {type: "raw_text", text}; both go through the existing rich-text path
  • cell text is flattened to one line; | is escaped, while <url|label> link tokens are left intact so the mrkdwn→markdown pass still converts them
  • ragged rows are padded to the widest row; empty tables render as nothing

Tests

Adds a fixture-pair harness (test/render-fixtures.test.ts): every test/fixtures/render/<name>.json must render exactly to its sibling <name>.txt, so new cases are a dropped-in pair. Expected outputs are .txt rather than .md so the pre-commit formatter never rewrites exact renderer output. Regenerate after an intentional rendering change with UPDATE_RENDER_FIXTURES=1 bun test render-fixtures.

Fixtures cover cell edge cases (escaped pipes, links, multi-line cells), empty rows, a table nested in an attachment, and an attachment with only fallback text.

🤖 Generated with Claude Code

Composer-built tables arrive as table blocks — directly in blocks, or
nested inside attachment blocks where the fallback text is just
'[no preview available]' — and were previously dropped from rendered
message content.

Render them as GitHub-flavored tables: rich_text or raw_text cells,
newlines flattened, pipes escaped while <url|label> tokens stay intact
for the mrkdwn conversion pass, ragged rows padded to the widest row.

Adds a fixture-pair test harness (json in, expected md out); regenerate
expected outputs with UPDATE_RENDER_FIXTURES=1 bun test render-fixtures.

Co-Authored-By: Claude Fable 5 <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