Add support for mentioning channels by ID. e.g. <#C04A9JK5R3Z>#49
Merged
jsarafajr merged 2 commits intojsarafajr:masterfrom Jun 19, 2025
Merged
Add support for mentioning channels by ID. e.g. <#C04A9JK5R3Z>#49jsarafajr merged 2 commits intojsarafajr:masterfrom
jsarafajr merged 2 commits intojsarafajr:masterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #49 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 109 109
Branches 18 18
=========================================
Hits 109 109 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR updates the mention parsing logic to also support channel mentions by ID, in addition to the existing user mention support.
- Updates regex patterns in src/slackify.js to include the '#' prefix.
- Adds a new test case for channel mention in test/slackify-markdown.test.js.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/slackify.js | Updated regex to handle both '@' and '#' prefixes |
| test/slackify-markdown.test.js | Added test to verify channel mention handling |
Comments suppressed due to low confidence (1)
src/slackify.js:14
- The variable name 'isEndOfUserMention' is now used to check mentions that may include channels as well as users. Consider renaming it to a more inclusive name, such as 'isEndOfMention'.
const isEndOfUserMention = Boolean(m.match(/<[@#][A-Z0-9]+$/));
jsarafajr
reviewed
Jun 19, 2025
Owner
|
Thanks, will publish as new minor version today |
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.
Similar to user mentions, Slack supports mentioning channels via their ID. For example
<#C04A9JK5R3Z>will be transformed to#general. This PR adds the#prefix to the existing@prefix in the regex for checking user mentions, so that the angle brackets don't get escaped. Test included.