A pandoc filter to render math equations using KaTeX.
It is powered by the katex
Rust crate.
bash
cargo install pandoc-katex
Alternatively, you can download the pre-built binaries from releases.
bash
pandoc -t html --filter pandoc-katex \
--css https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css \
--css https://pandoc.org/demo/pandoc.css \
--standalone -o output.html /path/to/input.md
You can also pass additional flags to custom KaTeX rendering. For example, to use custom LaTeX macro:
bash
pandoc -t json /path/to/input.md | \
pandoc-katex --macro '\RR:\mathbb{R}' | \
pandoc -f json -t html \
--css https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css \
--css https://pandoc.org/demo/pandoc.css \
--standalone -o output.html
For more flags, see pandoc-katex --help
.
Options can also be read from external configure file. The configure file should be in .toml
format. For example:
```toml fleqn = true
[macros] "\RR" = "\mathbb{R}" ```
The configure file path can either be passed as a command line argument --config-file /path/to/config.toml
or set by environment variable PANDOC_KATEX_CONFIG_FILE
.
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.