Expand description
End-to-end “run this block”: single function every UI calls.
Flow:
- Parse the page (
.mdon disk → AST). - Walk the AST to find the block at
flat_index(DFS preorder). - Extract
(language, body)from its fence text. - Look up the runtime, call
execute. - Render the output as a
> **result:**subblock. - Upsert that subblock under the code block.
- Re-render the AST back to
.md, atomic-write, reconcile into the op log.
The function is sync today — runtimes are sync, the I/O is sync, the TUI calls it from its event loop. When we add long-running runtimes (compile-then-run Rust, streaming output) the boundary becomes an async wrapper; the orchestration stays the same.
Structs§
- RunReport
- What a successful run hands back to the caller (the UI). Enough to show a status-line message without re-reading the page.
Enums§
- RunError
- Errors that can happen around execution — before we ever reach the runtime, or while persisting its output.
Constants§
- DEFAULT_
TIMEOUT - Wall-clock budget for a single fence execution (non-iOS targets).
Functions§
- run_
block_ at_ index - Run the code block at
flat_indexinsidemd_paththrough the registry’s matching runtime. - run_
block_ at_ index_ if_ source_ changed - Cache-aware variant of
run_block_at_index.