feat(render): render Slack table blocks as GFM tables - #136
Open
jprichardson wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Tables built or pasted in the Slack composer arrive as
tableblocks — directly inblocks, or nested insideattachment.blockswhere the attachment's fallback text is just[no preview available].message get/message listpreviously dropped them from rendered content.This renders
tableblocks as GitHub-flavored tables:rich_textblocks or{type: "raw_text", text}; both go through the existing rich-text path|is escaped, while<url|label>link tokens are left intact so the mrkdwn→markdown pass still converts themTests
Adds a fixture-pair harness (
test/render-fixtures.test.ts): everytest/fixtures/render/<name>.jsonmust render exactly to its sibling<name>.txt, so new cases are a dropped-in pair. Expected outputs are.txtrather than.mdso the pre-commit formatter never rewrites exact renderer output. Regenerate after an intentional rendering change withUPDATE_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