Crates.io | katexit-example-nightly |
lib.rs | katexit-example-nightly |
version | 0.1.4 |
source | src |
created_at | 2022-10-29 12:36:12.00853 |
updated_at | 2022-10-29 12:36:12.00853 |
description | Rendered example of katexit with nightly rustc |
homepage | |
repository | https://github.com/termoshtt/katexit |
max_upload_size | |
id | 700995 |
size | 3,558 |
Insert KaTeX autorender script into rustdoc
#[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.
#[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.
--html-in-header
option in rustdoc to inserts KaTeX auto-render script. But it requires some complicated setting in Cargo.toml.