Skip to content

fix(message-parser): keep URL underscores from closing link-text emphasis - #41731

Open
AlgoArtist06 wants to merge 1 commit into
RocketChat:developfrom
AlgoArtist06:pr/41727-hyperlink-underscores-20260810
Open

fix(message-parser): keep URL underscores from closing link-text emphasis#41731
AlgoArtist06 wants to merge 1 commit into
RocketChat:developfrom
AlgoArtist06:pr/41727-hyperlink-underscores-20260810

Conversation

@AlgoArtist06

@AlgoArtist06 AlgoArtist06 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Proposed changes (including videos or screenshots)

Prevents an unmatched underscore in Markdown link text from treating an underscore in the URL as its emphasis closer.

Adds the exact reported regression case and a patch changeset for @rocket.chat/message-parser.

Keeps the change scoped to the message parser.

Issue(s)

Fixes #41725

Related to #41727

Steps to test or reproduce

  1. Post [test-with-a-text-containing-an_here](http://example.com?param=my_value) in a channel.
  2. Confirm only test-with-a-text-containing-an_here is displayed and the whole label links to http://example.com?param=my_value.
  3. Run corepack yarn workspace @rocket.chat/message-parser test --runInBand with Node 22.22.3.

Further comments

Local verification:

  • Message parser tests: 36 suites passed, 719 tests passed.
  • Message parser lint: passed with 0 errors and 6 existing warnings.
  • Message parser typecheck: passed.
  • Message parser build: passed.

The full Rocket.Chat monorepo test suite was not run because it is impractical for this focused parser change.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Fixed Markdown links so labels and URLs containing underscores are parsed and displayed correctly.
  • Tests

    • Added coverage for links containing hyphens and underscores.

@dionisio-bot

dionisio-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f4526e4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@rocket.chat/message-parser Patch
@rocket.chat/gazzodown Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The message parser now preserves underscores in Markdown link labels when the URL also contains underscores. A parser test covers the link syntax, and a patch changeset documents the fix.

Changes

Message parser link fix

Layer / File(s) Summary
Link title parsing and validation
packages/message-parser/src/grammar.pegjs, packages/message-parser/tests/link.test.ts, .changeset/calm-links-render.md
LinkTitle handles the affected leading underscore pattern as plain text. The test verifies the complete link label and URL. The changeset records a patch release for @rocket.chat/message-parser.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: type: bug

Suggested reviewers: ggazzo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The grammar fix and regression test address incorrect hyperlink rendering when both link text and URL contain underscores [#41725].
Out of Scope Changes check ✅ Passed The changeset, parser update, and regression test are all within the linked issue scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the parser fix for underscores in link text and URLs.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • UNDERSCORES-20260810: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@AlgoArtist06

Copy link
Copy Markdown
Contributor Author

Cross-linking the other open PRs on #41725 so a maintainer does not have to untangle this:

Only one of these should land. Happy to close this one if either of the others is preferred.

@AlgoArtist06 AlgoArtist06 changed the title fix: address underscore link parsing gap in #41727 fix(message-parser): keep URL underscores from closing link-text emphasis Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong display of hyperlinks when an underscore is present in the text

1 participant