•mime — Rich display

•mime Y returns the MIME bundle that display uses for Y. The bundle is a keyed vector from MIME types to text, or to bytes for a binary type such as image/png. It always has text/plain. If Y has a renderer, •mime calls it with Y as ω and adds the entries it returns to the bundle.

The built-in renderers add these types:

F •mime Y returns Y with the renderer that F holds, as in {["text/html":"</b>",⍨"<b>",⍕ω]}ˢ •mime Y. With a MIME type as the left argument, display shows Y itself as that type, as in "text/markdown" •mime "*hi*". An atom becomes a scalar, because only an array can hold a renderer.

A result keeps a renderer when it has an item for each item of its argument, as pervasive functions, Each and scans do. Rearranging or selecting from an array without removing an axis also keeps the renderer, as reversal, transpose, take, replicate and catenation do. Changes in place keep the renderer. Other functions drop the renderer, as reductions and ρ do. When two arguments have different renderers, the result has none. Match ignores renderers.

Display shows the text form when a renderer fails. Only a direct •mime call reports the error. Rich display covers renderers.

Errors: DOMAIN for a left argument that holds neither a function nor text.