arborium-docsrs-demo
This crate demonstrates arborium syntax highlighting on docs.rs.
docs.rs highlights Rust code natively, but leaves other languages (TOML, shell,
JSON, YAML, SQL, etc.) unhighlighted. This crate uses arborium's IIFE script
via --html-in-header to highlight everything else.
How it works
-
Create
arborium-header.html: -
Add to
Cargo.toml:[] = ["--html-in-header", "arborium-header.html"]
That's it! The IIFE automatically:
- Detects code blocks by
class="language-*" - Skips Rust blocks (they have semantic
<a>links from rustdoc) - Highlights everything else with tree-sitter grammars
See the demo
Visit the module documentation to see highlighted TOML, shell, JSON, YAML, SQL, and more.