Expand description
Inline kitty graphics support for the nms REPL / one-shot
evaluator.
When the user evaluates a form whose value is a Value::Bytes
that sniffs as an image AND stdout is connected to a kitty-graphics
capable terminal, the value-printer emits a kitty APC sequence
containing the image. The image renders inline at the cursor;
subsequent text lines below sit beneath it.
Capability detection mirrors tui::chart::supports_kitty so an
nms invocation and a TUI session inside the same terminal agree
on what to emit. The --no-graphics CLI flag short-circuits the
detection for CI captures and for users whose terminal the
heuristics misidentify.
Enums§
- Image
Format - Image format the kitty graphics protocol can transmit directly.
f=100corresponds to PNG;f=24/f=32would be raw RGB/RGBA. We never auto-convert SVG → PNG inline (that lives in theplottingcrate’s:format pngkeyword path); SVG bytes fall through to the textual#u8(...)printer.
Functions§
- encode_
kitty - Wrap
bytesof a known image format into a single kitty graphics APC sequence. The sequence is appended toout, which keeps callers in control of stdout buffering —nmsprints it through the normal value-formatter, and tests can capture the bytes for comparison. - sniff
- Detect the image format by magic bytes. Returns
Nonefor any payload that isn’t a known inline-renderable raster. - supports_
kitty - Mirror of
tui::chart::supports_kittyfor the standalonenmsprocess. Returns true when the surrounding terminal advertises kitty-graphics support via env vars set by the terminal emulator. - try_
render_ inline - Convenience entry that returns the kitty APC payload as a String
when the bytes are a known image and the terminal supports kitty
graphics, otherwise
None. The caller falls back to the textual#u8(...)printer when this returnsNone.