Add MathJax for fancier Math display

feature/epub-rendering
trivernis 4 years ago
parent 9584cfaed2
commit 291da3a72b

2
Cargo.lock generated

@ -592,7 +592,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "snekdown"
version = "0.19.1"
version = "0.19.2"
dependencies = [
"asciimath-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"charred 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",

@ -1,6 +1,6 @@
[package]
name = "snekdown"
version = "0.19.1"
version = "0.19.2"
authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018"
license-file = "LICENSE"

@ -198,7 +198,8 @@ A = [[1, 2],[3,4]]
$$$
```
Currently math only get's rendered into MathML which is only supported by Safari and Firefox.
The expression get's converted into MathML which is then converted by MathJax when loaded in
the browser.
## Roadmap

@ -113,7 +113,16 @@ impl ToHtml for Document {
if self.is_root {
let style = minify(std::include_str!("assets/style.css"));
format!(
"<!DOCTYPE html>\n<html><head {}><style>{}</style></head><body><div class='content'>{}</div></body></html>",
"<!DOCTYPE html>\
<html>\
<head {}>\
<script id='MathJax-script' async src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'></script>
<style>{}</style>\
</head>\
<body>\
<div class='content'>{}</div>\
</body>\
</html>",
path, style, inner
)
} else {

Loading…
Cancel
Save