Arborium — High-performance syntax highlighting
Arborium provides batteries-included syntax highlighting powered by tree-sitter. It supports 60+ languages with automatic language injection (e.g., CSS/JS in HTML).
Quick Start
use Highlighter;
let mut hl = new;
let html = hl.highlight?;
// Output: <a-k>fn</a-k> <a-f>main</a-f>() {}
HTML vs ANSI Output
Use [Highlighter] for HTML output (web pages, documentation):
use ;
// Default: custom elements (<a-k>, <a-f>, etc.)
let mut hl = new;
// Or use class-based output for CSS compatibility
let config = Config ;
let mut hl = with_config;
Use [AnsiHighlighter] for terminal output:
use AnsiHighlighter;
use builtin;
let theme = catppuccin_mocha.clone;
let mut hl = new;
let colored = hl.highlight?;
println!;
Language Support
Enable languages via feature flags:
[]
= { = "0.1", = ["lang-rust", "lang-python"] }
Or enable all languages:
[]
= { = "0.1", = ["all-languages"] }
Advanced Usage
For building custom grammar providers or working with raw spans, see the
[advanced] module.