Formatter-agnostic helpers used across warning renderers to normalize Erlang terms and render rich diffs.
Summary
Functions
Wraps text with ANSI color codes when enabled? is true.
Computes a +/- diff between two lists of strings, highlighting only the differing segments while keeping delimiters balanced.
Converts Erlang-ish term output into Elixir-friendly string lines.
Functions
Wraps text with ANSI color codes when enabled? is true.
Computes a +/- diff between two lists of strings, highlighting only the differing segments while keeping delimiters balanced.
Returns a flat list of formatted lines (already prefixed with - or +).
Examples
iex> result = Assay.Formatter.Helpers.diff_lines(["(atom())"], ["(binary())"], color?: false)
iex> List.flatten(result)
["- (atom())", "+ (binary())"]
Converts Erlang-ish term output into Elixir-friendly string lines.
Printable binaries are stringified.
Examples
iex> Assay.Formatter.Helpers.format_term_lines("%{title => <<116,105,116,108,101>>}")
["%{title => \"title\"}"]