StatifierUI.EventLog.Markdown (StatifierUI v0.1.0)

Copy Markdown View Source

Renders a StatifierUI.EventLog.t() as Markdown a host hands to Kino.Markdown.new/1, per the sui-t36.5 plan's Phase 3.

render/2 is a pure function over the log and the StatifierUI.EventLog.Labels.t() that resolves its indexes - it names Kino only in this moduledoc and calls nothing under Kino.*. sui-t36.8 owns wrapping the returned string in an actual Kino.Markdown widget.

Structure

A header line naming the session (and a drop warning when the log's truncated? is true), then one block per macrostep - a collapsible <details>/<summary> by default, or a plain ### Macrostep <n> heading with collapsible: false - each holding a Markdown table with one row per round, that round's notes (a raised-cause line, its executed content, a budget-exhausted line), and the macrostep's round-less effect.* messages listed last under their own heading. A footer names session.halted/ session.terminated/session.unroutable when the log carries one.

exited and entered render through Labels.states/2 in list order (ADR-0011): this module never re-sorts either list.

Summary

Functions

Renders log as a Markdown string.

Types

open_selector()

@type open_selector() :: :last | :all | :none | [non_neg_integer()]

opt()

@type opt() ::
  {:labels, StatifierUI.EventLog.Labels.t()}
  | {:collapsible, boolean()}
  | {:open, open_selector()}

Functions

render(log, opts \\ [])

@spec render(StatifierUI.EventLog.t(), [opt()]) :: String.t()

Renders log as a Markdown string.

Options:

  • :labels - a Labels.t() to resolve indexes with. Defaults to Labels.from_log(log).
  • :collapsible - wraps each macrostep in <details>/<summary> when true (the default), or renders a plain ### Macrostep <n> heading with no HTML when false.
  • :open - which macrosteps start open when :collapsible is true: :last (the default, opens the highest-numbered macrostep), :all, :none, or a list of macrostep numbers.