diff --git a/Cargo.lock b/Cargo.lock index 08473b0..8a75d96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -859,7 +859,6 @@ dependencies = [ "chrono", "comrak", "glob", - "latex2mathml", "minify-html", "ramhorns", "reqwest", @@ -1271,12 +1270,6 @@ 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 81ab82d..3e3d187 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,5 @@ 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 0e84049..014ff89 100644 --- a/src/misc/markdown.rs +++ b/src/misc/markdown.rs @@ -18,6 +18,7 @@ pub struct FileMetadata { #[derive(Content)] pub struct Metadata { pub info: FileMetadata, + pub math: bool, pub mermaid: bool, pub syntax_highlight: bool, } @@ -52,9 +53,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_: true, - escape: false, // may change in the future? + 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? list_style: ListStyleType::Dash, sourcepos: false, }, @@ -64,11 +65,8 @@ 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, &text, &options); + let root = parse_document(&arena, raw_text, &options); // Find metadata let metadata = get_metadata(root); diff --git a/templates/blog/footer.html b/templates/blog/footer.html index c818b21..ac69c96 100644 --- a/templates/blog/footer.html +++ b/templates/blog/footer.html @@ -2,7 +2,31 @@ Retour à la liste des posts -{{#data}} {{#post}} {{#metadata}} {{#mermaid}} +{{#data}} {{#post}} {{#metadata}} {{#math}} + + + + +{{/math}} {{#mermaid}}