Skip to content

Convert Slack mention patterns to native Block Kit elements - #10

Open
presmihaylov wants to merge 1 commit into
navidemad:mainfrom
presmihaylov:feat/slack-mention-elements-upstream
Open

Convert Slack mention patterns to native Block Kit elements#10
presmihaylov wants to merge 1 commit into
navidemad:mainfrom
presmihaylov:feat/slack-mention-elements-upstream

Conversation

@presmihaylov

Copy link
Copy Markdown
Contributor

Summary

  • Adds post-processing step to convert <@U...> user mentions, <#C...> channel mentions, and <!subteam^S...> usergroup mentions into proper Slack Block Kit elements (RichTextSectionUserElement, RichTextSectionChannelElement, RichTextSectionUserGroupElement)
  • Previously these patterns were left as literal text in RichTextSectionTextElement nodes, causing Slack to render them as plain text instead of clickable mentions
  • Follows the same pattern as the existing emoji shortcode resolution — a new resolveMentions() function is chained via resolveInlines() at all flush points

Test plan

  • 11 new unit tests covering: standalone mentions, embedded in text, channel/usergroup mentions, multiple mentions, bold-styled mentions, mentions in lists, mentions in blockquotes, non-mention angle brackets preserved, combined with emojis
  • All existing tests pass (including emoji and table tests)
  • Verified with real Slack API — sent test messages to a Slack channel confirming user mentions, channel mentions, mixed mentions, bold mentions, and list mentions all render correctly as clickable elements

🤖 Generated with Claude Code

<@U...> user mentions, <#C...> channel mentions, and <!subteam^S...>
usergroup mentions in text are now resolved into proper
RichTextSectionUserElement, RichTextSectionChannelElement, and
RichTextSectionUserGroupElement objects instead of being left as
literal text in RichTextSectionTextElement nodes.

This follows the same post-processing pattern as emoji shortcode
resolution. A new resolveInlines() function chains resolveEmojis()
and resolveMentions() at all flush points (paragraph, blockquote,
list item).

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