Convert emoji shortcodes to native Slack emoji elements - #4
Closed
presmihaylov wants to merge 8 commits into
Closed
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tables previously rendered as ASCII art inside code-fenced SectionBlocks, which wrapped poorly for long cell values. Slack's native TableBlock (added Aug 2025) provides per-column wrapping and alignment. This change upgrades slack-go to v0.18.0 and rewrites table rendering to use it. Cells are now *RichTextBlock, so inline formatting (bold, links, code) is preserved automatically instead of being stripped to plain text. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Empty cells now get a minimal RichTextSection instead of producing "elements": null which the Slack API would reject - Update Go version requirement from 1.22+ to 1.25+ in CLAUDE.md, README.md, and DEMO.md to match go.mod - Fix stale doc.go prose still referencing SectionBlock for tables - Update README.md table mapping for GFM tables - Add TestConvert_TableEmptyCell test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Slack rejects messages with more than one table (only_one_table_allowed). ChunkBlocks now forces a new chunk before every additional TableBlock, in addition to the existing maxPerMessage split. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add nil guard to emitBlock to prevent appending nil blocks - Reset style stack at table cell entry to prevent style leaking - Document ChunkBlocks table-per-chunk enforcement in README - Add tests for multiple tables, mixed blocks, and code-in-cell Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Incorporates upstream feat/native-table-block changes (GFM tables now render as native Slack TableBlocks with rich text cells and per-column alignment). Fixes empty cell handling — Slack API rejects empty string text elements, so use a space instead. Updates module path to fork. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Slack's rich_text blocks require emojis as explicit RichTextSectionEmojiElement objects — plain text shortcodes like 📊 are rendered literally. Goldmark's emphasis parser also splits text at underscores, fragmenting shortcodes across multiple text elements. Add post-processing in resolveEmojis() that merges adjacent text elements with the same style and converts detected :emoji_name: patterns into proper emoji elements. Applied in flushInlineToSection(), paragraph emission, and blockquote accumulation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Closing in favor of a new PR based on upstream main (the original used the fork's module path). |
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.
Summary
rich_textblocks require emojis as explicitRichTextSectionEmojiElementobjects — plain text shortcodes like:bar_chart:are rendered as literal text, not as emojis:bar_chart:into:bar_+chart:across separate text elementsresolveEmojis()post-processing that merges adjacent same-style text elements (reassembling fragments) and converts detected:emoji_name:patterns into properRichTextSectionEmojiElementobjectsflushInlineToSection(), paragraph emission, and blockquote accumulation so emojis work in all contexts (paragraphs, lists, blockquotes, tables)Changes
resolveEmojis(),mergeAdjacentText(),stylesEqual()helpers and emoji shortcode regex. UpdatedflushInlineToSection()to resolve emojis before flushing.resolveEmojis()in paragraph emission and blockquote accumulation paths.TestConvert_EmojiShortcodeswith 10 subtests covering: single emoji, embedded emoji, multiple emojis, underscore-containing names (speech_balloon), bold styling inheritance, non-emoji colon preservation,+1emoji, list items, blockquotes, and JSON serialization. Added emoji seed to fuzz test.Test plan
Convert()andChunkBlocks()signatures unchanged🤖 Generated with Claude Code