40 stable releases
| 2.12.4 | Jan 18, 2026 |
|---|---|
| 2.12.3 | Jan 17, 2026 |
| 2.4.7 | Dec 30, 2025 |
| 1.3.0 | Dec 13, 2025 |
| 0.900.0 | Dec 9, 2025 |
#876 in Development tools
10KB
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:<script defer src="https://cdn.jsdelivr.net/npm/@arborium/arborium@2.12.4/dist/arborium.iife.js"></script> -
Add to
Cargo.toml:[package.metadata.docs.rs] rustdoc-args = ["--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.