Roles and users can be pinged inside of code blocks

(#403) Bug Closed: Fixed markdown notifications

Summary

When adding a role or user ping inside of a code block, the ping is still created.

Steps to reproduce

  1. Get the ID of a role or user.
  2. Write <@&id> (for a role) or <@id> (for a user) inside of a code block (```), where "id" is the role or user ID
  3. Send the message. The role or user will be pinged.

Environment (optional)

stable build 87 (28da28c), 2026-03-11 14:24:05 UTC, Chrome 144.0.0.0, Linux (x86)

Logs or screenshots (optional)

image image

2 comments

Sign in with Fluxer to comment and vote.
Comment by @cproudlock
RexSystem 1 vote originally by @cproudlock on GitHub
The rendering side is fine — code blocks display mentions as plain text. The issue is that notifications are still triggered for mentions inside code blocks. The mention parsing in packages/markdown_parser/src/parsers/InlineParsers.tsx (around lines 270-339) processes mentions unconditionally without checking whether they're inside a code block context. The block parser (BlockParsers.tsx) handles code blocks at a higher level, but the notification extraction layer doesn't consult the AST to check whether a mention node is a child of a CodeBlock node. The fix should be applied wherever mentions are extracted for notification purposes (not in the renderer, which already handles this correctly). Before triggering a notification for a mention, the code should walk up the AST to verify the mention isn't inside a CodeBlock or InlineCode node.