Represents a notebook which itself is a sequence of {@link NotebookCell code or markup cells}. Notebook documents are created from {@link NotebookData notebook data}.

Fields

read onlyversion:Int

The version number of this notebook (it will strictly increase after each change, including undo/redo).

read onlyuri:Uri

The associated uri for this notebook.

Note that most notebooks use the file-scheme, which means they are files on disk. However, not all notebooks are saved on disk and therefore the scheme must be checked before trying to access the underlying file or siblings on disk.

@link FileSystemProvider}

See also:

  • {

save():Thenable<Bool>

Save the document. The saving will be handled by the corresponding {@link NotebookSerializer serializer}.

Returns:

A promise that will resolve to true when the document has been saved. Will return false if the file was not dirty or when save failed.

read onlynotebookType:String

The type of notebook.

read onlymetadata:DynamicAccess<Any>

Arbitrary metadata for this notebook. Can be anything but must be JSON-stringifyable.

read onlyisUntitled:Bool

Is this notebook representing an untitled file which has not been saved yet.

read onlyisDirty:Bool

true if there are unpersisted changes.

read onlyisClosed:Bool

true if the notebook has been closed. A closed notebook isn't synchronized anymore and won't be re-used when the same resource is opened again.

getCells(?range:NotebookRange):Array<NotebookCell>

Get the cells of this notebook. A subset can be retrieved by providing a range. The range will be adjusted to the notebook.

Parameters:

range

A notebook range.

Returns:

The cells contained by the range or all cells.

read onlycellCount:Int

The number of cells in the notebook.

cellAt(index:Int):NotebookCell

Return the cell at the specified index. The index will be adjusted to the notebook.

@link NotebookCell cell}.

Parameters:

index
  • The index of the cell to retrieve.

Returns:

A {