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

Plain-text formatter for MF2 highlight tokens.

Concatenates every token's text and discards the class. The output
equals the canonical MF2 string produced by
`Localize.Message.Print.to_string/1` — this property is verified
in the highlighter test suite.

# `render`

```elixir
@spec render([Localize.Message.Highlighter.token()]) ::
  String.t() | {:error, Exception.t()}
```

Concatenates the text of every token into a single string.

### Arguments

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

### Returns

* A plain string — the canonical MF2 message.

### Examples

    iex> {:ok, ast} = Localize.Message.Parser.parse("Hello {$name}!")
    iex> tokens = Localize.Message.Highlighter.to_tokens(ast)
    iex> Localize.Message.Formatter.Plain.render(tokens)
    "Hello {$name}!"

---

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