# `StatifierUI.DatamodelExplorer.Markdown`
[🔗](https://github.com/riddler/statifier-ui/blob/v0.11.0/lib/statifier_ui/datamodel_explorer/markdown.ex#L1)

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.*`, so the same string serves a
Livebook cell, a generated docs page, or a test assertion.
`StatifierUI.Kino.Updater` is the widget wrapper: it hands
`StatifierUI.Inspector.datamodel/1`'s string, which is this module's
output, to `Kino.Markdown.new/1` for the inspector's datamodel frame.

## Structure

A header line naming the mode and either the scenario (authoring) or the
session and macrostep (live), the ADR-0012 line naming the projection
profile and saying editing is off when the pane is projected
(`DatamodelExplorer.edit_disabled_reason/1`), 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.

# `opt`

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

# `render`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
