# `Alaja.Syntax.Renderer`
[🔗](https://github.com/Lorenzo-SF/alaja/blob/2.1.0/lib/alaja/syntax/renderer.ex#L1)

Converts token lists to ANSI-formatted terminal output.

Uses `ChunkText` as intermediate representation so colors and effects
are resolved through Pote's theme system — same pipeline that
`Alaja.print_success`, `Alaja.Components.Table` etc. already use.

# `render`

```elixir
@spec render(
  [{atom(), String.t()}],
  Alaja.Syntax.Language.t(),
  Alaja.Syntax.Theme.t() | nil
) :: [
  {String.t(), String.t()}
]
```

Renders a token list into display-ready `{color, text}` tuples.

Each tuple's color is an ANSI color string resolved through
the theme chain:
  1. Language-level colors (`lang.colors`)
  2. Global syntax theme
  3. Hardcoded defaults

## Examples

    iex> lang = %Alaja.Syntax.Language{
    ...>   name: "test",
    ...>   colors: %{keyword: {:blue, [:bold]}}
    ...> }
    iex> Renderer.render([{:keyword, "def"}, {:plain, " x"}], lang)
    [{"blue", "def"}, {"white", " x"}]

# `render_ansi`

```elixir
@spec render_ansi(
  [{atom(), String.t()}],
  Alaja.Syntax.Language.t(),
  Alaja.Syntax.Theme.t() | nil
) ::
  iodata()
```

Renders tokens to ANSI escape sequences ready for terminal output.

Uses `ChunkText.render/1` under the hood, which resolves colors
through Pote's resolver bridge (supports atoms, hex, `"theme:key"`,
etc.) and applies effects (bold, italic, etc.).

# `render_plain`

```elixir
@spec render_plain([{atom(), String.t()}]) :: String.t()
```

Renders token list as a flat string (no ANSI escapes).
Useful for testing or non-terminal output.

---

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