scroll
v0.2.0Interactive notebook for March — Livebook-style in the browser
$ forge add scrollDocsScroll
Interactive notebook for March — Livebook-style in the browser.
Notebooks are plain Markdown files (.scrollmd) with fenced March code blocks. Open them in the browser, run cells interactively, and save changes back to disk.
Requirements
March 0.8.0 or newer. Scroll has no package dependencies: it serves the notebook with the standard library's HttpServer and WebSocket.
Installation
Scroll is a forge tool: installing it adds the scroll.serve command. It's listed on the forge registry at <https://forgepm.org/packages/scroll>.
Install directly from the GitHub source:
forge install https://github.com/march-language/scrollOr from a local checkout:
git clone https://github.com/march-language/scroll
forge install ./scrollBuilding from a checkout
git clone https://github.com/march-language/scroll
cd scroll
forge checkUsage
Open a notebook
forge notebook serve path/to/analysis.scrollmdforge notebook serve finds the project the notebook belongs to (the nearest forge.toml at or above it) and runs the notebook's cells:
- with that project's
lib/and its dependencies (path, git and registry,
resolved as `forge build` resolves them) available to `import`;- with the March toolchain the project pins in
.march-version, if any; - from the project's root directory, so relative paths in cells resolve
against the project wherever you start the server.A notebook outside any project gets a forge.toml of its own beside it. --port N picks the port (default 4040) and --no-open skips opening the browser.
forge scroll.serve FILE also starts the server, but it does not resolve the notebook's project.
Running cells
- ▶ Run All runs every code cell in order, reusing the REPL's state.
- Restart & Run All starts a fresh March runtime first, so the outputs
reflect the notebook as written rather than earlier runs.- Run Stale re-runs only the cells your edits affected: the edited cell
and the later cells that use a name it defines. A cell that loads data is
not re-run unless it changed.Cells run in the March interpreter. To use the REPL JIT instead, set MARCH_REPL_INTERP=0 in Env.
Exploring data
Three modules ship with Scroll. Import the ones a notebook uses:
import ScrollTable
import ScrollChart
import ScrollInputTables
ScrollTable.csv("data/orders.csv")
ScrollTable.json("report.json") -- an array of objects
ScrollTable.json_at("report.json", ["models"]) -- an array inside an object
ScrollTable.json_value(value, "label") -- a JsonValue you already parsed
ScrollTable.rows(["day", "orders"], [["1", "96"], ["2", "102"]])
ScrollTable.data_frame(df)The table shows each column's inferred type (int, float, bool, date or text) and how many values are missing (empty, NA, null, NaN, ...). Click a column to sort it and type in the filter box to narrow the rows. Large tables page 100 rows at a time and send at most 5,000 rows to the browser; the type and missing-value summary covers every row. Open Data… in the toolbar adds a table cell for a file.
Charts
ScrollChart.new()
|> ScrollChart.title("Forecast error by lead")
|> ScrollChart.x_label("Lead (hours)")
|> ScrollChart.y_label("MAE (MW)")
|> ScrollChart.line("Weekly naive", hours, naive_mae)
|> ScrollChart.line("Chronos-2 Small", hours, chronos_mae)
|> ScrollChart.band("P10–P90", hours, p10, p90)
|> ScrollChart.show()Charts fill the notebook's width, give each series a legend entry and a hover tooltip, and skip NaN values. Marks: line, points, band, bars, and line_dates/points_dates/band_dates for ISO dates on the x axis. ScrollChart.to_spec returns the Vega-Lite spec itself.
Controls
let model = ScrollInput.select("Model", ["Weekly naive", "Chronos-2 Small"], "Chronos-2 Small")
let horizon = ScrollInput.slider("Horizon (days)", 1, 28, 14)Each call shows a control and returns its current value. Changing the control re-runs that cell and the cells that depend on it, and nothing else. Values are kept per notebook, so they survive a reload and Restart & Run All. Also: number, text, checkbox. A control's label is its key, so labels must be unique within a notebook.
Export
··· → Export HTML writes a standalone page with each cell's source and output. Charts are embedded as static SVG and tables as their current view.
Notebook format
A .scrollmd file is standard Markdown. Code cells use fenced March blocks:
# My Notebook
Some prose here.
```march
let x = 6 * 7x
- **Markdown cells** — rendered as HTML in the browser
- **Code cells** — run in sequence; each cell sees bindings from earlier cells
- **`let` bindings** are silent (no auto-print), just like a REPL assignment
- **Plain expressions** auto-print their value if non-unit
### Server cells
Long-running processes (HTTP servers, background workers) use the `march:server` fence:
````markdown
```march:server
HttpServer.start(3000)
Server cells run as background processes with Start/Stop controls in the UI.
## Running tests
```bash
cd /path/to/scroll
# Unit tests
MARCH_LIB_PATH=lib:lib/scroll march test test/test_scroll.march
MARCH_LIB_PATH=lib:lib/scroll march test test/test_scroll_data.march
# Browser-side unit tests (dependency analysis)
node --test test/js/scroll-deps.test.cjs
# End-to-end tests over the notebook WebSocket protocol
python3 test/test_scroll.pymarch test (the interpreter), as above.Development
After editing lib/scroll.march, changes are live immediately — no reinstall needed when installed as a path archive (forge install scroll@./).