# `Localize.Message.Formatter`
[🔗](https://github.com/elixir-localize/localize/blob/v0.38.0/lib/localize/message/formatter.ex#L1)

Dispatch module for rendering MF2 highlight tokens.

Delegates to one of the format-specific formatter modules based on
the `:format` option:

* `:plain` — plain text, discards classes. Used internally to
  produce the canonical MF2 string from a token stream.

* `:html` — HTML with per-token `<span>` wrappers.
  See `Localize.Message.Formatter.HTML`.

* `:ansi` — ANSI-coloured terminal output.
  See `Localize.Message.Formatter.ANSI`.

# `format`

```elixir
@type format() :: :plain | :html | :ansi
```

# `render`

```elixir
@spec render([Localize.Message.Highlighter.token()], format(), Keyword.t()) ::
  String.t()
```

Renders a token list in the chosen format.

### Arguments

* `tokens` is a list of `t:Highlighter.token/0` tuples.

* `format` is one of `:plain`, `:html`, or `:ansi`.

* `options` is a keyword list of format-specific options.

### Returns

* A rendered string.

---

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