Docs · API reference · Verso.Abstractions

DisplayContext Class#

Provides ambient access to the active display handler during cell execution. The execution pipeline sets the current handler before each cell runs and clears it afterward. User code reaches this through the Display(this object, string) extension method.

public static class DisplayContext

Inheritance System.Object → DisplayContext

Methods#

SetHandler(Func<object,string,Task>) Method#

Sets the ambient display handler. Returns an System.IDisposable that restores the previous handler when disposed.

public static System.IDisposable SetHandler(System.Func<object,string?,System.Threading.Tasks.Task> handler);

Parameters#

handler System.Func<System.Object,System.String,System.Threading.Tasks.Task>

A callback that accepts the object to display and an optional MIME type hint, formats it, and writes the output to the cell.

Returns#

System.IDisposable