Multi-line, indented .dxn rendering — Dextrin.encode/2's
pretty: true opt, mix dextrin.format's --mode pretty, and mix dextrin.decode's default output (a CLI decode is a human reading
the result, so encode/2's own single-line default isn't the right
default there). --mode condense needs no separate implementation
at all: it's exactly what Dextrin.encode/2/Dextrin.Text.Printer
already produce with pretty: false (the default).
A value has no comments, so this formatter has none to keep. To lay
out a document and keep its comments, parse it as a
Dextrin.Document and use Dextrin.Document.format/2, which lays a
comment-free document out exactly as this module lays out its value.
Summary
Functions
Renders value as multi-line, indented .dxn text. Returns
{:ok, _} | {:error, _}, matching Dextrin.Text.Printer.print/2 —
the only way this can fail is the same as print/2's: a struct with
no tag_encoder/schema module registered (or one that itself
returns {:error, _}).
Functions
@spec pretty(term(), keyword()) :: {:ok, String.t()} | {:error, Dextrin.Error.t()}
Renders value as multi-line, indented .dxn text. Returns
{:ok, _} | {:error, _}, matching Dextrin.Text.Printer.print/2 —
the only way this can fail is the same as print/2's: a struct with
no tag_encoder/schema module registered (or one that itself
returns {:error, _}).
opts[:indent] sets the number of spaces per nesting level (default
2); every other opt (registry:, ...) is the same
as print/2's.