Skip to content

fix(mobile): show embedded images in Markdown previews - #31304

Merged
nwparker merged 5 commits into
mainfrom
nwparker/mobile-markdown-images
Oct 21, 2026
Merged

nwparker merged 5 commits into
mainfrom
nwparker/mobile-markdown-images

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​172 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​171

Markdown file previews replaced embedded images with alt-text links, hiding screenshots and diagrams that are essential to reading project documentation. Standalone images now render in the document and expand in the existing full-screen image viewer.

Relative image paths resolve from the document directory and use the existing workspace files.readPreview RPC, including on headless and remote hosts. Unsupported/outside-workspace paths are refused; failed loads offer Retry. Terminal artifact grants are not reused. Public HTTP(S) image URLs use the native image loader.

Related to #24468; this change covers Markdown file previews.

Reproduction: open Files → architecture.md containing ![Architecture](architecture.png). Before: only the alt-text link appears. After: the diagram is visible within the document.

Validation: native iPhone simulator before/after and full-screen expansion; 49 focused tests; mobile typecheck; production mobile bundle build; changed-code quality gate.

Before / after:

markdown-image-before.png
markdown-image-after.png

Credit to @dudupii for reporting and diagnosing #24468 and implementing the broader image solution in #24469. I reviewed that PR's authored-source/display-source separation, paired-host image reads, file-preview rendering, and zoom scope. Related editor integration remains in #25594, which preserves @dudupii's authored commit. This PR independently covers standalone images in the read-only file preview and its existing full-screen viewer; editor image serialization, inline images, and pinch zoom remain separate. #24468 stays open for that broader editor/device scope.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e63acc70-5de1-4e56-b532-76ad05ed2ee5
📥 Commits

Reviewing files that changed from the base of the PR and between f698b34 and e39acb9.

📒 Files selected for processing: 4
  • mobile/src/files/MobileFileMarkdownPreview.tsx
  • mobile/src/files/MobileFilePreviewBody.tsx
  • mobile/src/files/MobileFilePreviewScreen.tsx
  • mobile/src/files/MobileMarkdownPreviewImage.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

📝 Walkthrough

Mobile Markdown rendering now supports a custom image renderer. Worktree file previews use it to load Markdown image sources and display images with loading, error, retry, and full-screen viewer states. The source loader passes through HTTP(S) URLs and validates relative image paths before requesting workspace previews. Tests cover Markdown image syntax, source loading, and image display behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to e39ac

Markdown previews in the mobile app now show embedded images for worktree files. No outstanding issues were found in the reviewed changes, and the earlier test typing concern is fixed.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: displaying embedded images in mobile Markdown previews.
Description check Passed The description explains the user impact, implementation, security and path handling, related issue, visual proof, and validation results. It does not reproduce every template heading or checklist ite…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the user impact, implementation, security and path handling, related issue, visual proof, and validation results. It does not reproduce every template heading or checklist item, but the core required information is present.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ebbbef31-82f5-4ec7-9264-aea8d9c2da03
📥 Commits

Reviewing files that changed from the base of the PR and between ecee346 and f698b34.

📒 Files selected for processing: 11
  • mobile/src/components/MobileMarkdown.rendering.test.tsx
  • mobile/src/components/MobileMarkdown.tsx
  • mobile/src/components/mobile-markdown-blocks.tsx
  • mobile/src/files/MobileFileMarkdownPreview.test.ts
  • mobile/src/files/MobileFileMarkdownPreview.tsx
  • mobile/src/files/MobileFilePreviewBody.tsx
  • mobile/src/files/MobileFilePreviewScreen.tsx
  • mobile/src/files/MobileMarkdownPreviewImage.test.tsx
  • mobile/src/files/MobileMarkdownPreviewImage.tsx
  • mobile/src/files/mobile-markdown-image-source.test.ts
  • mobile/src/files/mobile-markdown-image-source.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant