Fix /spoiler command not converting markdown to HTML - #35103
Draft
jasonjose007 wants to merge 2 commits into
Draft
jasonjose007 wants to merge 2 commits into
jasonjose007 wants to merge 2 commits into
Conversation
The spoiler slash command was inserting the raw message text directly into the formatted_body HTML span, so markdown syntax and special characters were never processed. Run the message through htmlSerializeFromMdIfNeeded so that e.g. **bold** becomes <strong>bold</strong> inside the spoiler span. Fixes element-hq#21185 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes #21185
The
/spoilerslash command was inserting raw message text directly into theformatted_bodyHTML span, so markdown (e.g.**bold**) and newlines were never processed into HTML.Before:
"formatted_body": "<span data-mx-spoiler>**secret** message</span>"After:
"formatted_body": "<span data-mx-spoiler><p><strong>secret</strong> message</p></span>"Change
In
apps/web/src/slash-commands/SlashCommands.tsx, runmessagethrough the already-importedhtmlSerializeFromMdIfNeeded(withforceHTML: true) before wrapping it in the spoiler span — matching how the rest of the message pipeline handles content.Test plan
/spoiler **bold**produces<strong>bold</strong>inside the span/spoiler plain textrenders correctly