Arborium is a new open-source project that brings tree-sitter-based syntax highlighting to Rust documentation. It bundles 96 language grammars into Rust crates that compile to both native and WebAssembly targets. The project offers three integration approaches: a JavaScript/WASM script for immediate use on docs.rs, a rustdoc PR to add native highlighting support, and a post-processor that adds highlighting to existing HTML documentation with minimal size overhead. The solution addresses long-standing limitations in docs.rs by providing accurate, comprehensive syntax highlighting without requiring full documentation rebuilds.

14m read timeFrom fasterthanli.me
Post cover image
Table of contents
BackgroundProblemsSolutionsarboriumAngle 1: just include this scriptAngle 2: it goes in the rustdoc holeAngle 3: only in the backendPost-mortemConclusionSome mistakes Rust doesn't catch
1 Comment

Sort: