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_changedand by the TUI’s auto-run loop.
Functions§
- render_
result_ body - Render an
ExecOutput(or a top-levelExecError) as the markdown body of a result subblock. - result_
source_ hash - Read the
source-hash::recorded in the result subblock underparent, if any. ReturnsNonewhen no result subblock exists or when it was written without the hash (pre-auto-run runs). - source_
hash - SHA-256 of
source, formattedsha256:<hex>. Same shape asoutl_md::sidecar::content_hashbut 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_childbut also stamps the result subblock with asource-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
parentwith embed children.