Add to your Cargo.toml :
Script tag (zero config)
Add this to your HTML and all <pre><code> blocks get highlighted automatically:
< script src =" https://cdn.jsdelivr.net/npm/@arborium/arborium@1/dist/arborium.iife.js " ></ script >
Your code blocks should look like this:
< pre >< code class =" language-rust " > fn main() {} </ code ></ pre > <!-- or --> < pre >< code data-lang =" rust " > fn main() {} </ code ></ pre > <!-- or just let it auto-detect --> < pre >< code > fn main() {} </ code ></ pre >
Configure via data attributes:
< script src =" ... " data-theme =" github-light " <!-- theme name --> data-selector =" pre code " <!-- CSS selector --> data-manual <!-- disable auto-highlight --> data-cdn =" unpkg " ></ script > <!-- jsdelivr | unpkg | custom URL -->
With data-manual , call window.arborium.highlightAll() when ready.
See the IIFE demo →