5 releases

0.1.4 Oct 29, 2022
0.1.3 Oct 29, 2022
0.1.2 Apr 6, 2022
0.1.1 Aug 30, 2021
0.1.0 Aug 28, 2021

#437 in Procedural macros

Download history 1806/week @ 2023-12-06 2052/week @ 2023-12-13 2001/week @ 2023-12-20 1655/week @ 2023-12-27 2581/week @ 2024-01-03 2269/week @ 2024-01-10 2511/week @ 2024-01-17 1872/week @ 2024-01-24 1912/week @ 2024-01-31 1891/week @ 2024-02-07 3069/week @ 2024-02-14 2444/week @ 2024-02-21 3278/week @ 2024-02-28 3081/week @ 2024-03-06 2882/week @ 2024-03-13 3141/week @ 2024-03-20

13,072 downloads per month
Used in 57 crates (12 directly)

Apache-2.0

7KB
61 lines

Crate docs.rs

Insert KaTeX autorender script into rustdoc

Usage

#[cfg_attr(doc, katexit::katexit)]
/// We can write $\LaTeX$ expressions
///
/// Display style
/// -------------
///
/// $$
/// c = \\pm\\sqrt{a^2 + b^2}
/// $$
pub fn my_func() {}

See rendered result on docs.rs.

How it works

#[katexit] proc-macro inserts KaTeX autorender script as #[doc = "{script}"]. Since the markdown to HTML translator of rustdoc do not touch HTML partitions embedded in markdown, they will be passed as it is to the browser. The autorender script starts rendering the math expression enclosed by $ written in the document section when you open the page generated by rustdoc, i.e. this does not work offline.

Dependencies

~1.5MB
~34K SLoC