diff --git a/Cargo.lock b/Cargo.lock
index 8a75d96..08473b0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -859,6 +859,7 @@ dependencies = [
"chrono",
"comrak",
"glob",
+ "latex2mathml",
"minify-html",
"ramhorns",
"reqwest",
@@ -1270,6 +1271,12 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388"
+[[package]]
+name = "latex2mathml"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "678cf5bdb3ba63a264e6e0c9eee36538ca1d2da0afa4dd801c1f96309e710765"
+
[[package]]
name = "lazy_static"
version = "1.4.0"
diff --git a/Cargo.toml b/Cargo.toml
index 3e3d187..81ab82d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,5 +20,6 @@ serde_yaml = "0.9"
minify-html = "0.10.8"
glob = "0.3.1"
comrak = "0.18"
+latex2mathml = "0.2.3"
reqwest = { version = "0.11", features = ["json"] }
chrono = "0.4.24"
diff --git a/src/misc/markdown.rs b/src/misc/markdown.rs
index 014ff89..0e84049 100644
--- a/src/misc/markdown.rs
+++ b/src/misc/markdown.rs
@@ -18,7 +18,6 @@ pub struct FileMetadata {
#[derive(Content)]
pub struct Metadata {
pub info: FileMetadata,
- pub math: bool,
pub mermaid: bool,
pub syntax_highlight: bool,
}
@@ -53,9 +52,9 @@ pub fn get_options() -> ComrakOptions {
hardbreaks: false, // could be true? change by metadata could be good for compatibility
github_pre_lang: false,
full_info_string: true,
- width: 0, // 0 mean disabled?
- unsafe_: false, // could be true? change by metadata could be good for compatibility
- escape: false, // may change in the future?
+ width: 0, // 0 mean disabled?
+ unsafe_: true,
+ escape: false, // may change in the future?
list_style: ListStyleType::Dash,
sourcepos: false,
},
@@ -65,8 +64,11 @@ pub fn get_options() -> ComrakOptions {
pub fn read(raw_text: &str) -> File {
let arena = Arena::new();
+ // LaTeX conversion to MathML
+ let text = latex2mathml::replace(raw_text).unwrap_or_default();
+
let options = get_options();
- let root = parse_document(&arena, raw_text, &options);
+ let root = parse_document(&arena, &text, &options);
// Find metadata
let metadata = get_metadata(root);
diff --git a/templates/blog/footer.html b/templates/blog/footer.html
index ac69c96..c818b21 100644
--- a/templates/blog/footer.html
+++ b/templates/blog/footer.html
@@ -2,31 +2,7 @@
Retour à la liste des posts
-{{#data}} {{#post}} {{#metadata}} {{#math}}
-
-
-
-
-{{/math}} {{#mermaid}}
+{{#data}} {{#post}} {{#metadata}} {{#mermaid}}