Skip to content

feat(notifications): Render comment Markdown natively with a MarkdownSection - #133114

Open
sentry-junior[bot] wants to merge 8 commits into
masterfrom
fix/render-comment-mention-bold
Open

sentry-junior[bot] wants to merge 8 commits into
masterfrom
fix/render-comment-mention-bold

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Issue comments are Markdown, and the comment composer saves each mention as bold (**@Jane Doe**). The comment notification template passed the text through as one PlainTextBlock, so email and Slack showed the raw Markdown: **@Jane Doe** works!

This adds a MarkdownSection to the notification platform. A template puts Markdown source in it, and each provider renders it natively instead of the template parsing it into text blocks:

  • Slack: a markdown block, which takes standard Markdown. The text is truncated to the block's 12,000 character limit.
  • Email HTML: mistune with escape=True, which escapes raw HTML and replaces unsafe link schemes such as javascript:.
  • Email plain text, Discord, and MS Teams: the Markdown as-is, since all three show or render it directly.

The note template now returns its comment as a MarkdownSection. Because the comment is never split into blocks, mentions next to punctuation and line breaks keep their original spacing.

The template puts > in front of every line of the comment, so it still renders as a quote in Slack, email, and Discord. MS Teams doesn't support quotes and shows a literal >. As in the Sentry UI, single newlines inside a paragraph render as spaces in email HTML.

The /debug/notifications previewer skips section types it doesn't know, so it won't show the comment until #133321 teaches it markdown.

via @hobzcalvin.

--

View Session [Sentry]

The comment composer saves mentions as **@name** and **#team**. The
comment notification template passed that text through as plain text,
so email and Slack showed the literal asterisks. Split the comment into
bold and plain text blocks so each renderer formats the mentions.

Co-Authored-By: Grant Patterson <82265+hobzcalvin@users.noreply.github.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 1, 2026
@sentry-junior
sentry-junior Bot requested a review from hobzcalvin December 1, 2026 22:40
Strip only spaces from comment segments, so a mention on its own line
doesn't collapse a multiline comment into one line.
Replace the bold-only regex with mistune's AST, so comment notifications
also render code, italics, links, paragraphs, lists, and code blocks, and
`**` inside code stays literal. Links that aren't http, https, or mailto
render as plain text.

Co-Authored-By: Grant Patterson <82265+hobzcalvin@users.noreply.github.com>
@sentry-junior sentry-junior Bot changed the title fix(notifications): Render comment mentions as bold in email and Slack fix(notifications): Render comment Markdown in email and Slack Dec 2, 2026
Comments are Markdown, so the note template now passes them through as a
MarkdownSection instead of parsing them into text blocks. Each provider
renders it natively: a Slack markdown block, escaped HTML from mistune in
email, and the raw Markdown in plaintext email, Discord, and MS Teams.

Co-Authored-By: Grant Patterson <82265+hobzcalvin@users.noreply.github.com>
@sentry-junior sentry-junior Bot changed the title fix(notifications): Render comment Markdown in email and Slack feat(notifications): Render comment Markdown natively with a MarkdownSection Dec 2, 2026
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
scraps Ignored Ignored Preview Dec 3, 2026 1:08am UTC

Request Review

@sentry-junior
sentry-junior Bot requested a review from hobzcalvin December 3, 2026 00:10
@hobzcalvin
hobzcalvin marked this pull request as ready for review December 3, 2026 00:49
@hobzcalvin
hobzcalvin requested a review from a team as a code owner December 3, 2026 00:49
@hobzcalvin hobzcalvin removed their assignment Dec 3, 2026
@hobzcalvin

Copy link
Copy Markdown
Contributor

Before/after in Slack:
Screenshot 2026-12-02 at 5 01 26 PM
Screenshot 2026-12-02 at 5 00 56 PM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants