Skip to content

fix(message-parser): parse emojis and inline elements inside headings#39197

Open
Harshit2405-2004 wants to merge 2 commits intoRocketChat:developfrom
Harshit2405-2004:fix-heading-emoji-parsing
Open

fix(message-parser): parse emojis and inline elements inside headings#39197
Harshit2405-2004 wants to merge 2 commits intoRocketChat:developfrom
Harshit2405-2004:fix-heading-emoji-parsing

Conversation

@Harshit2405-2004
Copy link

@Harshit2405-2004 Harshit2405-2004 commented Feb 28, 2026

Proposed changes

Fixes #33067.

The PEG grammar in message-parser previously restricted Heading chunks to raw HeadingString tokens. This prevented nested inline elements, like Emojis (# :smile:) and bold variations, from being parsed correctly into their structural AST node objects.

This PR updates the parser grammar block to evaluate standard Inline rules recursively inside Heading components, restoring native markdown formatting behavior without negatively impacting simple text rendering. Verified by expanding testing capabilities for emoji-nested headlines.

Summary by CodeRabbit

  • Bug Fixes
    • Headings now correctly parse and render emojis and inline formatting. Emojis placed before, after, or between words in heading text are preserved in order and display as expected.
    • Improves reliability of heading rendering so nested emojis and mixed inline markdown inside headings no longer break or lose content.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Feb 28, 2026

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
Copy link

changeset-bot bot commented Feb 28, 2026

🦋 Changeset detected

Latest commit: f9b5f72

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

This PR includes changesets to release 42 packages
Name Type
@rocket.chat/message-parser Patch
@rocket.chat/meteor Patch
@rocket.chat/core-services Patch
@rocket.chat/core-typings Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/rest-typings Patch
@rocket.chat/pdf-worker Patch
rocketchat-services Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/http-router Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/models Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch 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
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 329c2d3 and f9b5f72.

📒 Files selected for processing (1)
  • packages/message-parser/src/grammar.pegjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/message-parser/src/grammar.pegjs

Walkthrough

Grammar and tests updated to correctly parse emoji and inline markdown inside heading blocks; a patch changeset documents the fix. Tests assert emoji can appear at start, end, and intermixed within headings.

Changes

Cohort / File(s) Summary
Changeset Documentation
​.changeset/fix-heading-emoji-parsing.md
Added a patch changeset for @rocket.chat/message-parser describing the heading emoji/inline markdown parsing fix.
Grammar Parsing Logic
packages/message-parser/src/grammar.pegjs
Adjusted Heading and HeadingChunk rules to return heading content as inline elements (pass text directly rather than wrapped arrays/plain(...)) so emoji tokens are emitted as emoji nodes.
Test Coverage
packages/message-parser/tests/heading.test.ts
Imported emoji helper and added tests covering emoji at start, end, and mixed within heading content to validate parsing behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

type: bug

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing emoji and inline element parsing inside headings, which directly addresses the core issue and changeset.
Linked Issues check ✅ Passed The PR successfully implements the required fix: grammar updated to parse emoji identifiers and inline elements within headings, with test coverage added to verify emoji parsing behavior.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing emoji and inline element parsing in headings: grammar rules, test updates, and changeset documentation are all directly related to resolving the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/message-parser/src/grammar.pegjs">

<violation number="1" location="packages/message-parser/src/grammar.pegjs:151">
P2: HeadingChunk now repeats Inline, which can consume EndOfLine; this allows a heading to absorb multiple subsequent non-empty lines into the same heading instead of stopping at the line boundary.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

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.

Emoji identifiers in headline markdown are not evaluated

1 participant