Interface Cell

All Known Implementing Classes:
CodeCell, MarkdownCell, RawCell

public sealed interface Cell permits CodeCell, MarkdownCell, RawCell
A single cell in a Jupyter notebook. The cell type is determined by the cell_type field and can be one of "code", "markdown", or "raw".

The id field was added in nbformat 4.5 and is required in nbformat 5 (nbformat_minor ≥ 4). It must be a string of 1–64 characters matching [a-zA-Z0-9_\-]. When reading legacy notebooks (nbformat_minor < 4) the field may be absent; in that case id() returns null.

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the cell type identifier.
    id()
    Returns the unique cell identifier.
    Returns the cell-level metadata.
    Returns the source content of the cell as a multiline string.
  • Method Details

    • cellType

      String cellType()
      Returns the cell type identifier.
      Returns:
      "code", "markdown", or "raw".
    • metadata

      CellMetadata metadata()
      Returns the cell-level metadata.
      Returns:
      the cell metadata.
    • source

      MultilineString source()
      Returns the source content of the cell as a multiline string. In the notebook JSON this is stored as a list of strings or a single string; Jackson handles both via MultilineString.
      Returns:
      the cell source lines.
    • id

      String id()
      Returns the unique cell identifier.

      Required in nbformat 5 (nbformat_minor ≥ 4). Must be a string of 1–64 characters matching [a-zA-Z0-9_\-]. May be null when reading notebooks saved with an older minor version.

      Returns:
      the cell id, or null for legacy notebooks.