1 unstable release
0.1.0  Feb 25, 2024 

#533 in Math
140KB
Add math to rust doc, e.g., docs.rs
This repo shows how to add latex math to https://docs.rs; Math is rendered by katex.
How it works
It embeds a piece of html into the rust doc that contains a javascript snippet rendering latex math.
Usage

To build doc with math locally:
make
Or:RUSTDOCFLAGS="htmlinheader katex.html" cargo doc nodeps

To build doc with math for docs.rs, add the following lines to
Cargo.toml
:[package.metadata.docs.rs] rustdocargs = [ "htmlinheader", "katex.html" ]
Rendering options
This repo provides two snippet for rendering:

katex.html
renders$`i+1`$
into inline math, and math code block such into math block:```math i+1 ```

katexdollar.html
renders$i+1$
into inline math, and$$i+1$$
into block math.
Each of these two files is about 257 KB
in size.
And nonpacked versions are *src.html
.