Alaja.Syntax.Builtin (Alaja v2.4.0)

Copy Markdown View Source

Built-in inline tokenizers for common languages: Elixir, JSON, Markdown.

These are kept for backward compatibility and fast-path CLI rendering. For full language support (Python, Rust, Go, etc.) use Alaja.Syntax.register_language/2 with Alaja.Syntax.Engine.

Summary

Functions

ANSI 16-colour palette for the buffer pipeline — maps atoms to {r, g, b} tuples. Bright variants use the half-bright split. Unknown atoms fall back to white.

Maps a token type atom to an ANSI color name (string).

Maps a token type atom to an atom colour name (for buffer pipeline).

Tokenizes Elixir source code.

Tokenizes JSON source code.

Tokenizes Markdown source code.

Functions

ansi_16_colors()

@spec ansi_16_colors() :: %{required(atom()) => {0..255, 0..255, 0..255}}

ANSI 16-colour palette for the buffer pipeline — maps atoms to {r, g, b} tuples. Bright variants use the half-bright split. Unknown atoms fall back to white.

color_for(arg1)

@spec color_for(atom()) :: String.t()

Maps a token type atom to an ANSI color name (string).

color_for_atom(arg1)

@spec color_for_atom(atom()) :: atom()

Maps a token type atom to an atom colour name (for buffer pipeline).

tokenize_elixir(content)

@spec tokenize_elixir(String.t()) :: [{atom(), String.t()}]

Tokenizes Elixir source code.

tokenize_json(content)

@spec tokenize_json(String.t()) :: [{atom(), String.t()}]

Tokenizes JSON source code.

tokenize_markdown(content)

@spec tokenize_markdown(String.t()) :: [{atom(), String.t()}]

Tokenizes Markdown source code.