Module Quill.Cell
Notebook cells.
A cell is the atomic unit of a notebook: either a block of text or an executable code block with outputs.
Cell identifiers
val fresh_id : unit -> idfresh_id () is a fresh unique identifier.
Execution outputs
type output = | Stdout of string| Stderr of string| Error of string| Display of {}(*The type for cell execution outputs. A single execution may produce multiple outputs (e.g. stdout text followed by a displayed image).
Stdout sis captured standard output.Stderr sis captured standard error.Error sis an execution error message.Display {mime; data}is rich content identified by MIME type (e.g."text/html","image/png"). Binary data is base64-encoded indata.
Cells
type t = private | Code of {}| Text of {id : id;source : string;
}(*The type for notebook cells.
Codeis an executable code cell.languageidentifies the kernel (e.g."ocaml").execution_counttracks how many times this cell has been executed (starts at0).Textis a text cell whosesourceis markdown.
The type is private: pattern matching is allowed, but cells must be constructed via
*)codeandtext.
Constructors
code ?id ?language source is a code cell with the given source. language defaults to "ocaml". A fresh identifier is generated when id is not provided.
text ?id source is a text cell with the given source. A fresh identifier is generated when id is not provided.
Accessors
val source : t -> stringsource c is the source text of cell c.
Transformations
set_outputs os c is c with outputs replaced by os. Text cells are returned unchanged.
append_output o c appends o to the outputs of c. Text cells are returned unchanged.
clear_outputs c is c with an empty output list. Text cells are returned unchanged.