Repository navigation
fix: render html in pull request comment bodies as markdown - #808
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Important
HTML <blockquote> in a comment body throws while sanitizing, so that comment fails to render.
Reviewed changes
This pass reviewed the HTML-to-markdown sanitizer added for pull request comment bodies on desktop and mobile, plus the tests that pin bot-footer rendering.
- Comment HTML sanitizer — Converts the GitHub HTML subset (
<picture>,<img>,<a>, formatting, blocks, entities) to markdown beforeGptMarkdown, leaving fenced and inline code untouched. - Desktop and mobile wiring —
PullRequestCommentMarkdownand the mobile conversation_CommentBodynow sanitize immediately before render; the mobile file is the expected duplicate becausealera_mobilecannot import the root package. - Tests — Desktop unit tests pin exact conversions for the footer, images, dark
<picture>,javascript:hrefs, entities, and fences; a widget test pumps a bot footer; mobile covers the footer and fence cases against drift.
Grok | 𝕏
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This pass reviewed the follow-up commit that fixes the blockquote sanitizer crash and tightens CRLF / <br> handling, plus the tests that pin those arms.
- Blockquote capture group — Both desktop and mobile converters now read group 1, matching the one-capture regex, so HTML
<blockquote>no longer throws inbuild(). - CRLF and breaks — Prose segments drop a trailing
\r, and<br>consumes one following newline so a hard break does not become an extra paragraph. - Inline picture pass —
_sanitizeInlineno longer re-walks<picture>; the block pass already converted complete pictures, and the empty-src fallback still uses the inner<img>. - Coverage — Unit tests now pin blockquotes (including empty),
<pre>, strikethrough, inline<code>, headings, summaries, lists, Windows line endings, and pictures without a usable src.
Grok | 𝕏
- GitHub review bodies embed `<picture>`, `<img>`, `<a>`, and `<sub>` tags that `GptMarkdown` showed as literal text - Sanitize comment HTML to Markdown on desktop and mobile, preserving fenced and inline code - Prefer dark picture sources, convert anchors and formatting, and decode entities
- blockquote handler read group(2) on a one-group regex and threw on any <blockquote> - drop the unreachable picture arm from inline sanitizing - normalize CRLF in prose segments and fold one newline into <br> - extend unit tests to hold 100% domain coverage
- cli_tests.rs grew to 567 lines after workspace section tests landed, tripping the 500-line max-lines ratchet on every PR - move each command area into its own cli_*_tests.rs module behind the existing path-attribute pattern; cli_tests.rs keeps only declarations - give cli_issue_tests.rs explicit imports instead of super::*
leynier
force-pushed
the
fix/comments-markdown-rendering
branch
from
September 17, 2026 08:00
693e0ac to
57f785a
Compare
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.

Pull request comment bodies often contain a GitHub HTML subset (bot footers with
<picture>,<img>,<a>,<sub>,<br>, HTML comments), whichGptMarkdowndoes not render and showed up as literal text.What changed:
sanitizePullRequestCommentBodyinlib/src/features/pull_requests/domain/pull_request_comment_body.dartto convert that HTML subset to Markdown before rendering, and wire it intoPullRequestCommentMarkdown.mobile/lib/src/features/workbench/domain/pull_request_comment_body.dartand wire it intopull_request_conversation_section.dart.<picture>sources, links, inline formatting, blocks, breaks,<pre>, entities, and HTML comments while leaving fenced code blocks and inline code spans untouched.