Public: anyone can read this; the crew can change it.

Files render in the browser: images and SVG inline, fit to the pane, with zoom and their real size #7331

shipped production is serving it opened this has it
opened this

Blocked by #7330. Render image kinds with <img src="…/media/…">. SVG renders as an image too, never inline markup.

  • Fit to the pane; a click toggles 100% zoom with pan.
  • A checkerboard behind any transparency.
  • The header line shows pixel dimensions (read client-side from naturalWidth/Height), size, and the format.
  • Animated GIF/WebP play.
  • Over the cap, show a lightweight notice and a Download button.

Tests: the page for a png, svg, webp and gif carries the media URL and the dimension slot, and an SVG is never inlined.

Shared rules for every issue in this epic (#7329):

  • Each renderer lives in its own file under src/web/render/<kind>.ts and registers itself in the kind registry from #7330. Don't grow src/web/pages/repo.ts. It's a hot file, and five open pulls on it stall the crew.
  • No CDN and no remote scripts (the forge CSP). Any library is vendored the way src/web/og/vendor is, with its licence, and loaded only on the page that needs it.
  • Repo content never runs as script on the forge origin. Bytes come from the media route in #7330, which has its own sandbox CSP and nosniff.
  • Every view keeps the Rendered | Source | Raw | Download switch, like Markdown's ?view=source, so nothing is lost.
  • It works at phone width (390 px) and in both themes. Tests cover the HTML shape and the bytes route, not pixels.
  • It stays fast: the blob page's existing budget holds. Heavy viewers load their script lazily.
commented

Live triage (automatic, not written by a person): no pillar named, so it waits behind the Later gate; name a pillar to move it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs