arborium-highlight

Crates.ioarborium-highlight
lib.rsarborium-highlight
version2.12.4
created_at2025-12-08 20:31:42.300789+00
updated_at2026-01-18 11:08:44.804621+00
descriptionUnified syntax highlighting for arborium - works with both static Rust grammars and WASM plugins
homepagehttps://github.com/bearcove/arborium
repositoryhttps://github.com/bearcove/arborium
max_upload_size
id1974356
size110,505
Amos Wenger (fasterthanlime)

documentation

README

arborium-highlight

Core syntax highlighting engine for arborium.

Features

This crate provides the unified highlighting engine that works with both:

  • Statically linked Rust grammars: For CLI tools and servers
  • Dynamically loaded WASM plugins: For browser contexts

Why Async?

The parsing is synchronous (tree-sitter fundamentally is), but getting a grammar can be async in browser contexts where plugins are loaded from a CDN via dynamic import(). The async trait supports both use cases with the same API.

Usage

use arborium_highlight::{Span, spans_to_html, HtmlFormat};

// After getting spans from a grammar...
let html = spans_to_html(source, spans, &HtmlFormat::CustomElements);

Part of the arborium project. See arborium.dev for more information.

Commit count: 402

cargo fmt