Docs · API reference · Verso.Abstractions

INotebookOperations Interface#

Provides centralized notebook-level operations to all extensions. Accessed via Notebook.

public interface INotebookOperations

Properties#

ActiveLayoutId Property#

Gets the identifier of the currently active layout.

string? ActiveLayoutId { get; }

Property Value#

System.String

ActiveThemeId Property#

Gets the identifier of the currently active theme.

string? ActiveThemeId { get; }

Property Value#

System.String

Methods#

ClearAllOutputsAsync() Method#

Clears the outputs of all cells in the notebook.

System.Threading.Tasks.Task ClearAllOutputsAsync();

Returns#

System.Threading.Tasks.Task

ClearOutputAsync(Guid) Method#

Clears the outputs of a single cell.

System.Threading.Tasks.Task ClearOutputAsync(System.Guid cellId);

Parameters#

cellId System.Guid

Returns#

System.Threading.Tasks.Task

ExecuteAllAsync() Method#

Executes all cells in the notebook in order.

System.Threading.Tasks.Task ExecuteAllAsync();

Returns#

System.Threading.Tasks.Task

ExecuteCellAsync(Guid) Method#

Executes a single cell by its identifier.

System.Threading.Tasks.Task ExecuteCellAsync(System.Guid cellId);

Parameters#

cellId System.Guid

Returns#

System.Threading.Tasks.Task

ExecuteCodeAsync(string, string, CancellationToken) Method#

Executes arbitrary code in the specified language kernel without adding a visible cell. Variables and state persist in the kernel session and variable store.

System.Threading.Tasks.Task ExecuteCodeAsync(string code, string? language=null, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters#

code System.String

language System.String

ct System.Threading.CancellationToken

Returns#

System.Threading.Tasks.Task

ExecuteCodeCaptureOutputsAsync(string, string, CancellationToken) Method#

Executes arbitrary code like ExecuteCodeAsync(string, string, CancellationToken) and returns the outputs it produced, instead of discarding them. Used by callers (such as #!import) that need to surface an executed cell's outputs. The default implementation runs the code and returns no outputs, so hosts that do not capture outputs keep the existing fire-and-forget behavior.

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Verso.Abstractions.CellOutput>> ExecuteCodeCaptureOutputsAsync(string code, string? language=null, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters#

code System.String

language System.String

ct System.Threading.CancellationToken

Returns#

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<CellOutput>>

ExecuteFromAsync(Guid) Method#

Executes all cells starting from the specified cell through the end of the notebook.

System.Threading.Tasks.Task ExecuteFromAsync(System.Guid cellId);

Parameters#

cellId System.Guid

Returns#

System.Threading.Tasks.Task

InsertCellAsync(int, string, string) Method#

Inserts a new cell at the specified index.

System.Threading.Tasks.Task<string> InsertCellAsync(int index, string type, string? language=null);

Parameters#

index System.Int32

type System.String

language System.String

Returns#

System.Threading.Tasks.Task<System.String>
The identifier of the newly created cell.

MoveCellAsync(Guid, int) Method#

Moves a cell to a new position in the notebook.

System.Threading.Tasks.Task MoveCellAsync(System.Guid cellId, int newIndex);

Parameters#

cellId System.Guid

newIndex System.Int32

Returns#

System.Threading.Tasks.Task

RemoveCellAsync(Guid) Method#

Removes a cell by its identifier.

System.Threading.Tasks.Task RemoveCellAsync(System.Guid cellId);

Parameters#

cellId System.Guid

Returns#

System.Threading.Tasks.Task

RestartKernelAsync(string) Method#

Restarts the specified kernel, or the default kernel if no identifier is provided.

System.Threading.Tasks.Task RestartKernelAsync(string? kernelId=null);

Parameters#

kernelId System.String

Returns#

System.Threading.Tasks.Task

SetActiveLayout(string) Method#

Switches the active layout engine by its layout identifier.

void SetActiveLayout(string layoutId);

Parameters#

layoutId System.String

SetActiveTheme(string) Method#

Switches the active theme by its theme identifier.

void SetActiveTheme(string themeId);

Parameters#

themeId System.String