Runnable documents are JSONHTL documents that contain executable code cells. The notes browser displays them in a Jupyter-style interface with interactive cell execution.
1. Add "runnable": true at the top level of the document
2. Mark executable cells with "exec": true in codeblocks
3. Give each executable cell a unique "name" for stable reference
{
"title": "My Sheet",
"runnable": true,
"content": [
{"heading": {"level": 1, "text": "My Sheet"}},
{"para": ["Define a value, then compute with it."]},
{"codeblock": {"lang": "python", "exec": true, "name": "setup",
"body": "value = 42\nprint('value =', value)"}},
{"para": ["Compute something."]},
{"codeblock": {"lang": "python", "exec": true, "name": "compute",
"body": "print('double:', value * 2)"}}
]
}
- All cells share a single Python namespace for the sheet session- Variables defined in one cell are visible to later cells- Cells are designed to be run in document order; re-running an individual cell (e.g. to pick up new data) is fine, but any later cells that depend on its output should also be re-run- Exceptions are caught and displayed; the sheet continues to function
- input() calls are automatically detected and rendered as input fields- Run All executes all executable cells in document order- Clear Outputs removes displayed output (kernel state preserved)- Restart Kernel resets Python namespace- Export/Import saves and restores sheet state
For the complete JSONHTL format specification including runnable documents, see the JSONHTL specification document. For implementation details, usage examples, and control socket API reference, see the notes-browser design documentation.