Repository navigation
Description
Pre-submit Checks
- I have searched Warp feature requests and there are no duplicates
- I have searched Warp docs and my feature is not there
Describe the solution you'd like?
Warp's Markdown Viewer should render <picture>/<source media="(prefers-color-scheme: …)"> blocks, swapping between the light- and dark-mode image variant based on the current theme, falling back to the <img> inside <picture> when no <source> matches. This is the standard pattern for README badges and logos that need to stay legible in both light and dark rendering contexts.
Expected behavior: renders a single image that swaps between the light-mode and dark-mode <source> asset based on the active theme, falling back to the <img> if no source matches.
Is your feature request related to a problem? Please describe.
Any README with a logo or badge that needs to look right against both a light and dark background uses this pattern — it's effectively the only portable way to do theme-aware images in Markdown/HTML.
Concretely, today in Warp's Markdown Viewer (verified on this build):
The whole <picture> block, including the fallback <img>, renders as literal text — the fallback img is not implemented yet, see: #13721
Additional context
Test case:
# `<picture>`/`<source>` (light/dark variants)
Should render: a single image that swaps automatically between a light-mode and dark-mode asset based on the current theme. Currently: expect the raw tags to render as literal text, or — if the fallback `<img>` is what survives — a single static image with no theme-reactive swapping.
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://placehold.co/400x200/111827/FFFFFF/png?text=Dark+Mode">
<source media="(prefers-color-scheme: light)" srcset="https://placehold.co/400x200/FFFFFF/111827/png?text=Light+Mode">
<img src="https://placehold.co/400x200/FFFFFF/111827/png?text=Fallback" alt="Theme-aware logo">
</picture>Code pointers. As far as I can tell, this needs both parser work and image-model work, not just a new tag handler:
- No
picture/source/srcset/prefers-color-schemehandling exists in any parser; unknown elements fall to the genericcrates/markdown_parser/src/html_parser.rsrecurse-into-children arm, and since<source>is a void element, that yields nothing even there. - The image model is single-source:
ImageBlockConfigcarries{width, height, spacing}and aBlockItem::Imagewraps exactly oneAssetSource— there's no candidate-list or theme-variant field to select between. - There's no theme-swap precedent to build on either:
prefers-color-schemeonly appears in window-chrome theme detection (crates/warpui/src/platform/wasm/mod.rs,crates/warpui/src/windowing/winit/delegate.rs), unrelated to content rendering. This also depends on raw<img>support landing first (see Markdown viewer: support common raw-HTML subset (img sizing, tables, details, anchors) #13652 and its split-out<img>sizing issue) for the fallback path to mean anything on its own.
Related:
- Blocked by: Markdown viewer: support
<img>sizing attributes (width/height/align) #13721 -- as picture/source depend on img html tags working :P - cross-references Markdown viewer: support common raw-HTML subset (img sizing, tables, details, anchors) #13652 (the original bulk raw-HTML-subset request this was scoped out of).
Operating system (OS)
macOS
How important is this feature to you?
3
Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1
No response
Activity
warp-for-oss commentedon Jul 14, 2026
@fbartho
Here's what I found while triaging this issue:
Thanks — this looks like a real Markdown Viewer feature gap. The provided
<picture>/<source>test case is specific enough to route as a theme-aware image rendering enhancement, and it appears related to but distinct from the broader raw-HTML subset work in #13652.Maintainer details
I concluded that markdown Viewer currently lacks support for theme-aware
<picture>/<source>image selection and falls back to rendering that raw HTML pattern as text..Triage summary
This is an actionable Markdown Viewer feature request for theme-aware raw-HTML images:
<picture>with<source media="(prefers-color-scheme: ...)" srcset=...>should render as one image selected from the active theme, with the nested<img>as fallback.Evidence
<source>entries plus a fallback<img>.) asFormattedTextLine::Image, but raw HTML blocks in Markdown documents are not parsed into image blocks.picture,source,srcset, orimgintoFormattedImage.FormattedImage.source,BufferBlockItem::Image.source, andBlockItem::Image.asset_source), so implementing this fully likely needs both parser support and a theme-aware candidate-selection model.Likely code areas
crates/markdown_parser/src/markdown_parser.rsfor Markdown document parsing and block image parsing.crates/markdown_parser/src/html_parser.rsif raw HTML support is shared with pasted HTML or extended for HTML image tags.crates/editor/src/content/core.rs,crates/editor/src/content/text.rs, andcrates/editor/src/content/edit.rsfor converting parsed images into editor block items and layout tasks.crates/editor/src/render/model/mod.rsandcrates/editor/src/render/element/image.rsfor image block layout/rendering, currently based on one resolvedAssetSource.Duplicate check
No duplicate label recommended. #13652 is a recently closed broader raw-HTML-subset request that this issue explicitly says was split out, while open related issues such as raw
<img>sizing, raw tables, anchors, HTML preview, and SVG/image viewer support cover adjacent but distinct capabilities.This is my automated analysis and may be incorrect. A maintainer will verify the details.
Powered by Oz
warp-for-oss commentedon Jul 17, 2026
This issue has been labeled
ready-to-specand is open for contributions in the form of a product or technical spec. If you'd like to draft one, feel free to open a pull request with the spec underspecs/. You can also comment@oz-agenton this issue to have the bot draft the spec automatically.bnavetta commentedon Jul 17, 2026
I think this is reasonable to support, but would need further specification - for example, the approach for parsing media queries in the
<source>elements. We're unlikely to support the full set of media queries/attributes, so I'd like to be explicit about what's in-scope.fbartho commentedon Jul 17, 2026
Spec development Blocked by #13721 as the picture spec would incorporate the img spec/feature.
docs(specs): frame srcset deferral + load-failure visual (GH13721)