| Crates.io | math-in-rust-doc |
| lib.rs | math-in-rust-doc |
| version | 0.1.0 |
| created_at | 2024-02-25 07:02:54.978734+00 |
| updated_at | 2024-02-25 07:02:54.978734+00 |
| description | Demo of add math to rust doc |
| homepage | https://github.com/drmingdrmer/math-in-rust-doc |
| repository | https://github.com/drmingdrmer/math-in-rust-doc |
| max_upload_size | |
| id | 1152241 |
| size | 529,795 |
This repo shows how to add latex math to https://docs.rs; Math is rendered by katex.
It embeds a piece of html into the rust doc that contains a javascript snippet rendering latex math.
To build doc with math locally: make
Or: RUSTDOCFLAGS="--html-in-header katex.html" cargo doc --no-deps
To build doc with math for docs.rs, add the following lines to Cargo.toml:
[package.metadata.docs.rs]
rustdoc-args = [ "--html-in-header", "katex.html" ]
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
```
katex-dollar.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 non-packed versions are *-src.html.