ANSI terminal formatter for MF2 highlight tokens.
Wraps each token in ANSI colour escape codes suitable for IEx
output, mix task messages, or anywhere a terminal is assumed.
Colours are chosen for legibility on both light and dark
backgrounds using ANSI 4-bit colours only (no truecolor).
Summary
Functions
Renders a token list as an ANSI-coloured string.
Types
@type options() :: [ {:palette, %{required(Localize.Message.Highlighter.class()) => [atom()]}} ]
Functions
@spec render([Localize.Message.Highlighter.token()], options()) :: String.t()
Renders a token list as an ANSI-coloured string.
Arguments
tokensis a list oft:Highlighter.token/0tuples.optionsis a keyword list.
Options
:palette— a map%{class => [ansi_atom]}overriding the default colour for specific classes.
Returns
- A string containing ANSI escape codes.