nlx
The Nelson Notebook document format (.nlx).
📄Description

A .nlx file is the native Nelson Notebook document. It is a zip (OPC-style) container that keeps the source, the saved results and the figures apart in one portable file.

The container has these entries:

manifest.json - the format marker: format (nelson-notebook) and version.

document.json - the source: an object with a blocks array (the ordered content of the Notebook). This part stays small and diffs cleanly, and the headless reader parses it directly.

output.json - the saved results: for each code cell, its last text output, error and figure references, keyed by block id. It is regenerable by re-running the document, and kept apart so it never pollutes the source.

media/ - the figures a code cell produced, extracted as image files (for example media/fig0.png) so the JSON parts stay small and the images round-trip losslessly.

Each entry of blocks is an object with a type and a props object:

heading / paragraph - formatted text (a heading carries props.level).

codecell - a Nelson code cell; props.code is the code. Its results live in output.json, not in the cell.

equation - a LaTeX equation (props.latex).

the interactive controls (slider, drop-down, check box, ...) and live tasks - stored with their bound variable and value in props.

Only the codecell blocks are executable. notebook and run evaluate their props.code in order against the base workspace; edit opens the document in the Notebook editor.

A Notebook can also be saved as a plain-text .m file, where each block is written under a %% [kind] marker, so it opens in any editor and runs as an ordinary script.

💡Examples
The entries inside a .nlx container.
manifest.json
document.json
output.json
media/fig0.png
A minimal document.json.
{
  "blocks": [
    { "type": "heading", "props": { "level": 1 }, "content": "My Notebook" },
    { "type": "paragraph", "content": "A short description." },
    { "type": "codecell", "props": { "code": "x = linspace(0, 1, 10);\nplot(x)" } }
  ]
}
🔗See Also
notebookrunedit
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub