Expand description
Drawing an image in terminals that can draw one.
Screenshots are most of what gets attached to a bug, and the alternative to this is leaving the terminal to look at one. The risk is the opposite failure: a few kilobytes of escape codes dumped into a session that cannot render them is worse than never trying, so every rule here errs towards printing nothing.
Support is decided by what the terminal says it is, never by a pattern in
TERM. Kitty, Ghostty, WezTerm and iTerm2 each export a variable of their
own; a marker either matches exactly or the answer is no.
A multiplexer means no. TMUX or screen can inherit those variables
from the terminal they were started in while passing none of the graphics
through, which is exactly how the escape codes end up on screen as text.
The protocol decides the formats, not us. Kitty’s direct transmission takes PNG only; iTerm2’s takes whatever it can decode. Anything else falls back to the filename and the download command.
Structs§
- Inline
- Pictures to substitute for the markdown image references that name them, keyed by the URL exactly as it appears in the text.
- Picture
- A picture ready to be written, and the caption that goes under it.
Enums§
- Kind
- The image formats worth recognising, identified by their own bytes rather than by a name somebody else chose.
- Protocol
- An inline-image protocol a terminal understands.
- Refusal
- Why a terminal is getting no picture. Reported under
-v, because “it printed a filename instead of my screenshot” is otherwise unanswerable without reading this file.