StatifierUI.DatamodelExplorer.Markdown (StatifierUI v0.1.0)

Copy Markdown View Source

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

render/2 is a pure function over the pane - 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 mode and either the scenario (authoring) or the session and macrostep (live), a drop warning when truncated?, then one section per tier in the pane's tier order - entries/1 already produces its entries grouped contiguously by tier, so this module chunks on that grouping rather than re-deriving or re-sorting it (ADR-0011). Each section is a Markdown table of name, type label, and value; a changed? entry's name carries the :changed_marker suffix (default "*"), and each Entry.children element renders as its own row, qualified as "parent.child". A diagnostics section renders last, only when the pane carries any.

Values render with inspect/1 rather than re-encoded to JSON: this is a debugging view of decoded Elixir terms, and StatifierUI.Trace.Json is for the wire.

Summary

Functions

Renders pane as a Markdown string.

Types

opt()

@type opt() ::
  {:tiers, [StatifierUI.DatamodelExplorer.Entry.tier()]}
  | {:collapsible, boolean()}
  | {:changed_marker, String.t()}
  | {:max_keys, pos_integer()}
  | {:max_depth, pos_integer()}

Functions

render(pane, opts \\ [])

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

Renders pane as a Markdown string.

Options:

  • :tiers - when given, only entries whose tier is in this list get a section; the other tiers' sections are omitted entirely rather than rendered empty.
  • :collapsible - wraps each tier section in <details>/<summary> when true. Defaults to false - a plain ### <tier> heading.
  • :changed_marker - the suffix appended to a changed? entry's name. Defaults to "*".
  • :max_keys, :max_depth - passed straight through to StatifierUI.Shape.label/2 for every entry's type label, so a value's inferred shape can be rendered at a coarser grain than the entry was built with.