Renders a StatifierUI.DatamodelExplorer.Diff change list as Markdown a
host hands to Kino.Markdown.new/1 (sui-2uz).
Pure, like every other *.Markdown in this package: Kino is named in
this moduledoc and nowhere else, so the same string serves a Livebook
cell, a generated page, or a test assertion.
StatifierUI.Inspector.datamodel_diff/2 is the caller that pairs it with
the fold.
Values render with inspect/1, the same choice
StatifierUI.DatamodelExplorer.Markdown makes and for the same reason:
this is a debugging view of decoded Elixir terms, and
StatifierUI.Trace.Json is for the wire. Diff.absent/0 renders as a
dash rather than as :absent, because "there was no such slot" is not a
value the run ever held.
An empty change list renders as a sentence saying so, never as an empty table. A step that changed nothing is a fact about the run worth stating - a blank pane reads as a broken one.
Summary
Functions
Renders changes as a Markdown table.
Types
Functions
@spec render([StatifierUI.DatamodelExplorer.Diff.change()], [opt()]) :: String.t()
Renders changes as a Markdown table.
Options:
:title- the heading above the table. Defaults to"#### Datamodel changes";nilomits the heading entirely, for a host supplying its own.:empty_note- the line rendered instead of the table whenchangesis empty. Defaults to"_No datamodel slot changed._".
Examples
iex> changes = [
...> %{name: "attempts", tier: :data, kind: :changed, from: 1, to: 2}
...> ]
iex> StatifierUI.DatamodelExplorer.Diff.Markdown.render(changes, title: nil)
"| slot | tier | change | before | after |\n| --- | --- | --- | --- | --- |\n| `attempts` | data | changed | `1` | `2` |"
iex> StatifierUI.DatamodelExplorer.Diff.Markdown.render([], title: nil)
"_No datamodel slot changed._"