Skip to content

fix(mobile): an image in an ask or an artifact shows at its own size - #1056

Merged
Jacksondr5 merged 2 commits into
j5/mainfrom
j5code/mobile-1054
Nov 15, 2026
Merged

Jacksondr5 merged 2 commits into
j5/mainfrom
j5code/mobile-1054

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Problem

At Checkpoint 8 on Jackson's iPhone, a 200×200 image in an ask rendered as a tiny dot on the same line as the two file links. Web draws it at its own size. Closes #1054.

Cause

react-native-enriched-markdown draws an image that is the only thing in its paragraph as a block, but an image inside a line of text as an inline glyph at a fixed inlineImage: { size: 20 }. #1045's shared WorkspaceMarkdown also passed no renderImage, so even a block image went to Enriched's own media rendering, not the timeline's sized image view. The artifact viewer shares the component, so it had the same problem.

What changed

In WorkspaceMarkdown (the Inbox, the Captain's pinned ask, and the artifact viewer):

  • withBlockImages gives an image that shares a line with text a paragraph of its own. It leaves images in inline code, in fenced blocks, and inside a link ([![badge](…)](…)) as written. Tested.
  • renderImage draws images as the timeline and the file preview do (ThreadMarkdownImage), at their own size within the width. A press opens them in the preview.

UI changes

iOS

An Inbox ask with an image on the same line as text:

iOS before iOS after
An Inbox ask with an image on the same line as text, iOS before An Inbox ask with an image on the same line as text, iOS after

An Inbox ask with an image on the line after text:

An Inbox ask with an image on the line after text, iOS after

Android

An Inbox ask with an image on the same line as text:

Android before Android after
An Inbox ask with an image on the same line as text, Android before An Inbox ask with an image on the same line as text, Android after

The Captain's pinned ask with an image on the same line as text:

Android before Android after
The Captain's pinned ask with an image on the same line as text, Android before The Captain's pinned ask with an image on the same line as text, Android after

An artifact with an image on the same line as text:

Android before Android after
An artifact with an image on the same line as text, Android before An artifact with an image on the same line as text, Android after

A pressed image opening in the preview:

A pressed image opening in the preview, Android after

Live testing

iOS: PASS at 64485ef0ff against base e9e5085cfd (crew tester, report test-reports/pr-1056/ios-64485ef0ff.md), with the Mac's swap under the Captain's gate. A real Haiku ask from a worktree carried the single line of links and an image. Base shows a glyph of about 20pt. Head shows the full image block, with the links and the trailing text kept. A second ask, with the image on the line after text, also renders full size.

Android: PASS at 64485ef0ff against base e9e5085cfd (crew tester, report test-reports/pr-1056/64485ef0ff.md, stills only). The Inbox, the Captain's pinned ask and the artifact viewer each go from a tiny thumbnail to the image at full width within the card. Pressing the image opens the full-screen preview. The fixture was a real Haiku Peer's worktree artifact and its ask, with a 600×400 image.

Not exercised: an image inside a table, and the image-after-text form on Android (both are covered by withBlockImages's tests).

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior: withBlockImages
  • UI changes: before/after above
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: none
  • Upstream product: no change
  • Surfaces: mobile Inbox, pinned ask and artifact viewer (iOS and Android); web already draws images at size
  • Docs: none

Claude Opus 5.5 in J5 Code (Claude Code harness).

🤖 Generated with Claude Code

Enriched draws an image that shares a line with text as a 20-point inline
glyph, so Checkpoint 8's 200×200 image came out as a dot beside two links.
WorkspaceMarkdown, which the Inbox, the pinned ask and the artifact viewer
share, now gives such an image its own paragraph and draws images as the
timeline does, at their own size within the width, opening on a press.

Closes #1054

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
j5-code Ready Ready Preview Nov 15, 2026 9:58pm UTC

Request Review

@github-actions github-actions Bot added the vouch:trusted Author is trusted by repo permissions or the VOUCHED list. label Nov 15, 2026
@github-actions github-actions Bot added the size:M 30-99 effective changed lines (test files excluded in mixed PRs). label Nov 15, 2026
@Jacksondr5

Copy link
Copy Markdown
Owner Author

Review: reviewer-opus (single review, at the Captain's request), at dd716f7

Verdict: approve once two small changes to withBlockImages land.

Enriched's rule, from its source (web/utils.ts markInlineImages, the same rule as native): an image is drawn as a block only when it is the only child of its paragraph. Any other child, including a soft line break, makes it a 20pt inline glyph. I ran withBlockImages at the PR head on the inputs below.

Should fix

1. An image on its own line under text is still a dot.

  • "Here is the screenshot:\n![shot](shot.png)" comes back unchanged.
  • The image line has only one part, so kept.length <= 1 returns it as is. But it is still in the same paragraph as the line above, as [Text, SoftBreak, Image], so it renders inline at 20pt.
  • "Intro\n![shot](shot.png)\nmore" is the same.
  • This is probably the most common way an agent puts a screenshot in a message, more common than CP8's shape.
  • Fix: whenever a line outside code holds an image, set it off with blank lines on both sides too, not only from text on the same line. Blank lines added at the start or end are harmless. Add these two cases to the test.

2. A table row with an image is broken apart.

  • "| a | b |\n|---|---|\n| x ![p](p.png) | y |" becomes "…| x\n\n![p](p.png)\n\n| y |". That breaks the table, and the row's remaining cells become paragraphs.
  • Fix: skip table rows, for example if (/^\s*\|/.test(line)) return line;. An image in a cell staying small is the lesser problem. Add a test case.

Accepted as is

  • An image in a list item or a block quote (- item ![p](p.png) tail) moves out of the item into its own paragraph. The image now shows at its own size and the item loses only its tail, which is a fair trade without a real parser.
  • Indented code blocks aren't detected. That is rare in an agent's message.

Checked and fine

  • renderImage follows FileMarkdownPreview's image path:
    • ThreadMarkdownImageView for direct URIs, including SVG.
    • ThreadMarkdownImage for environment resources.
    • The unavailable view otherwise.
    • null for anything that isn't an image.
    • A FilePreviewModal on press.
  • The regex skips inline code and an image inside a link ([![badge](…)](…)). Fences are tracked by line.
  • Coverage: it fixes the Inbox, the Captain's pinned ask and the artifact viewer, which all use WorkspaceMarkdown.
  • Scope: J5-owned files only.
  • Checks: git diff --check, mobile typecheck, and blockImages.test.ts with the compiler coverage test (1103 passed) all pass.

— Claude Opus 5.5 (reviewer-opus), J5 Code

…ers as written

An image on the line after text still shared its paragraph through the
soft break, so it stayed inline; now any image line is set off with blank
lines. Table rows are left whole, so a table keeps its shape.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Jacksondr5

Copy link
Copy Markdown
Owner Author

Re-check at 64485ef: approved. Both fixes hold.

  • A line holding an image is now set off with blank lines from the text before and after it, so an image under a line of text gets its own paragraph.
  • Table rows are left whole.
  • I also checked:
    • Two image lines in a row split into two paragraphs.
    • An image just before a fence is set off from it.
    • An image inside inline code or a link is unchanged.
  • blockImages.test.ts (6 passed), mobile typecheck and git diff --check pass.

— Claude Opus 5.5 (reviewer-opus), J5 Code

@github-actions github-actions Bot added size:L 100-499 effective changed lines (test files excluded in mixed PRs). and removed size:M 30-99 effective changed lines (test files excluded in mixed PRs). labels Nov 15, 2026
Jacksondr5 added a commit that referenced this pull request Nov 15, 2026
@Jacksondr5
Jacksondr5 marked this pull request as ready for review November 15, 2026 22:07
@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 3 billable files and costs up to $0.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 30 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 59 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e9e5085 and 64485ef.

Files selected for processing: 3

  • apps/mobile/src/j5/artifacts/WorkspaceMarkdown.tsx
  • apps/mobile/src/j5/artifacts/blockImages.test.ts
  • apps/mobile/src/j5/artifacts/blockImages.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@Jacksondr5
Jacksondr5 merged commit 7a9a878 into j5/main Nov 15, 2026
44 of 46 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/mobile-1054 branch November 15, 2026 22:21
Jacksondr5 added a commit that referenced this pull request Nov 23, 2026

This branch was successfully deployed

1 active deployment
Preview — 64485ef0 Deployed Nov 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: an inline image in an ask renders at text size

1 participant