Repository navigation
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Images on their own line now render as standalone mobile images even when adjacent to captions, using the existing image-loading path. The change is limited to presentation, with guards to preserve list and blockquote structure. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Detect and separate standalone images apps/mobile/src/lib/markdownDocument.ts, apps/mobile/src/lib/markdownHtml.test.ts |
The paragraph visitor inserts line breaks around eligible standalone images, and the final edit pass sorts edits by source position. Tests cover images around captions in paragraphs, quotes, and lists, as well as inline images and cases that remain unchanged. |
Priority:
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested labels: bugfix, size:M
Suggested reviewers: juliusmarminge
Merge Risk: 
Minimal · up to 50dcb
-
Standalone images are separated from captions; inline images remain unchanged. No merge-blocking risk was identified.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the bug, implementation, scope decision, focused tests, broader checks, performance result, and unrun native rendering checks.
Full details: Linked Issues check
-
Explanation
[
#26663] The change detects Markdown images intransformNativeMarkdownand inserts paragraph breaks only when an image occupies its source line. The focused test passes the caption-above-image case throughmarkdownForNativeRenderingandparseMarkdown, and verifies a paragraph-onlyImage. This enables the existing standalone image path.PullRequestMarkdownsuppliesrenderImage, and itsMarkdownImageusesusePullRequestMediaUrl, which provides authenticated media loading for the standalone path. Inline images remain unchanged as documented. The test covers quotes, lists, newline forms, hard breaks, and inline images.
Full details: Out of Scope Changes check
-
Explanation
The diff changes only
apps/mobile/src/lib/markdownDocument.tsand its focused regression test. The implementation supports the linked image-rendering fix and preserves existing table and file-link processing. The broader native Markdown behavior and the documented badge effect are direct consequences of the shared transform, not unrelated work.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Closing in favour of #24735, which makes the same change. Thanks for the work here! |
Problem
On mobile, an image on the line right after a caption (
<sub>Before</sub>or plain text, with no blank line between them) shares the caption's paragraph. The native renderer offers its custom image slot, which loads private source-control media through the authenticated resolver at full size, only to an image that is the paragraph's only child. So the image falls back to the inline path with the raw URL. Privateuser-attachmentsURLs return 404 there, and the image disappears; it would also render as a small inline attachment. Fixes #26663.Change
transformNativeMarkdown(the existing pass that separates tables from text at render time) now also gives an image that is alone on its source line its own paragraph. It does this by inserting a blank line, with container markers kept, before and/or after that line:It adds no extra parse, and it runs only when the text contains
![.Scope and approval
This is a small, focused fix for an obvious bug, done the way the issue's own workaround suggests (a blank line). The same paragraph rule applies to every native Markdown surface, so images alone on their own line in thread messages are separated the same way. One visible side effect: a badge alone on its own line now renders as a block image. Badges on a shared line are unchanged. Routing inline images through
resolveImageSourcewas considered and not chosen: the PR media resolver is an async hook, and inline images would still render small.Verification
apps/mobile/src/lib/markdownHtml.test.ts. It runsmarkdownForNativeRendering, then the renderer's own md4c parser (react-native-enriched-markdown/src/web/parseMarkdown), and asserts eachImageis its paragraph's only child.mainit fails on the issue's<sub>caption case.vp run check:changed: passes.Claude Opus 5.5 (claude-opus-5-5) via Claude Code; reviewed by GPT-6.1 Sol (Codex).