Skip to main content

Module result_block

Module result_block 

Source
Expand description

Build and place the > **result:** subblock under a code block.

Pure functions on OutlineNode — no parsing, no I/O. Persisting the mutated AST is the caller’s job (see crate::orchestrate).

The result block is a child of the code block, identified by a literal > **result:** marker on its first line. Single-line outputs become an inline code span; multi-line outputs use a fenced code block so newlines render cleanly in any markdown viewer.

Constants§

RESULT_MARKER
Marker that identifies a result block. The very first non-whitespace text on the line must equal this.
SOURCE_HASH_KEY
Property key written into the result subblock so we can detect whether the parent’s source has changed since the last run. Used by crate::orchestrate::run_block_at_index_if_source_changed and by the TUI’s auto-run loop.

Functions§

render_result_body
Render an ExecOutput (or a top-level ExecError) as the markdown body of a result subblock.
result_source_hash
Read the source-hash:: recorded in the result subblock under parent, if any. Returns None when no result subblock exists or when it was written without the hash (pre-auto-run runs).
source_hash
SHA-256 of source, formatted sha256:<hex>. Same shape as outl_md::sidecar::content_hash but without whitespace normalisation — for code, whitespace IS the semantics.
upsert_result_child
Insert or replace the result child under parent.
upsert_result_child_with_hash
Same as upsert_result_child but also stamps the result subblock with a source-hash:: property. The auto-run loop reads that property to short-circuit re-runs when the parent source hasn’t changed.
upsert_result_embeds
Insert or replace the result child under parent with embed children.