From 5b0cc03ac81052b4dd2c0cb112e62e43fa6d8d81 Mon Sep 17 00:00:00 2001 From: Kenton Hamaluik Date: Sun, 1 Dec 2019 11:55:18 -0700 Subject: [PATCH] added rendering katex formulas --- Cargo.lock | 2 +- Cargo.toml | 2 +- docs-src/02-markdown/04-katex-formulas.md | 21 +++ docs/01-introduction/index.html | 5 +- docs/02-markdown/01-commonmark.html | 5 +- docs/02-markdown/02-syntax-highlighting.html | 5 +- docs/02-markdown/03-plantuml-diagrams.html | 11 +- docs/02-markdown/04-katex-formulas.html | 149 +++++++++++++++++++ docs/02-markdown/index.html | 5 +- docs/03-frontmatter/index.html | 7 +- docs/04-structure/index.html | 5 +- docs/05-customization/index.html | 5 +- docs/06-how-it-works/index.html | 5 +- docs/index.html | 7 +- src/main.rs | 114 +++++++++++--- templates/index.html | 1 + templates/page.html | 1 + 17 files changed, 312 insertions(+), 38 deletions(-) create mode 100644 docs-src/02-markdown/04-katex-formulas.md create mode 100644 docs/02-markdown/04-katex-formulas.html diff --git a/Cargo.lock b/Cargo.lock index 496c4b9..d1c34a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -411,7 +411,7 @@ dependencies = [ [[package]] name = "mkbook" -version = "0.2.0" +version = "0.3.0" dependencies = [ "askama 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index b90019d..7cab0db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mkbook" -version = "0.2.0" +version = "0.3.0" authors = ["Kenton Hamaluik "] edition = "2018" build = "build.rs" diff --git a/docs-src/02-markdown/04-katex-formulas.md b/docs-src/02-markdown/04-katex-formulas.md new file mode 100644 index 0000000..833ec5e --- /dev/null +++ b/docs-src/02-markdown/04-katex-formulas.md @@ -0,0 +1,21 @@ +--- +title = "KaTeX (Math) Formulas" +--- + +If you have [KaTeX](https://github.com/KaTeX/KaTeX) installed and available on your path, _mkbook_ will try to render any code blocks with a language tag of `katex` as inline math blocks. + +For example: + +~~~ +```katex +x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} +``` +~~~ + +is rendered as: + +```katex +x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} +``` + +This feature is still experimental, but I find it handy for my books. diff --git a/docs/01-introduction/index.html b/docs/01-introduction/index.html index 6f2dcf5..8b7a325 100644 --- a/docs/01-introduction/index.html +++ b/docs/01-introduction/index.html @@ -12,7 +12,8 @@ - + +