From 112a3843c5789623513266d4179f6b6507d2667e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 9 Oct 2023 16:32:28 +0200 Subject: [PATCH] update dependencies --- Cargo.lock | 74 ++++++++++++++++++++++++++++++++------------ Cargo.toml | 6 ++-- src/misc/markdown.rs | 64 +++++++++++++++++++------------------- 3 files changed, 88 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 84be85a..c90e435 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -256,6 +256,12 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -476,15 +482,16 @@ dependencies = [ [[package]] name = "cached" -version = "0.45.1" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90eb5776f28a149524d1d8623035760b4454ec881e8cf3838fa8d7e1b11254b3" +checksum = "8cead8ece0da6b744b2ad8ef9c58a4cdc7ef2921e60a6ddfb9eaaa86839b5fc5" dependencies = [ + "ahash", "async-trait", "cached_proc_macro", "cached_proc_macro_types", "futures", - "hashbrown 0.13.2", + "hashbrown 0.14.1", "instant", "once_cell", "thiserror", @@ -611,11 +618,12 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "comrak" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "482aa5695bca086022be453c700a40c02893f1ba7098a2c88351de55341ae894" +checksum = "82c995deda3bfdebd07d0e2af79e9da13e4b1be652b21a746f3f5b24bf0a49ef" dependencies = [ "clap", + "derive_builder", "entities", "memchr", "once_cell", @@ -696,7 +704,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "874c6e2d19f8d4a285083b11a3241bfbe01ac3ed85f26e1e6b34888d960552bd" dependencies = [ "derive_more", - "indexmap", + "indexmap 1.9.3", "nom", ] @@ -819,6 +827,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.1" @@ -1020,7 +1034,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -1043,6 +1057,16 @@ dependencies = [ "bumpalo", ] +[[package]] +name = "hashbrown" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +dependencies = [ + "ahash", + "allocator-api2", +] + [[package]] name = "heck" version = "0.3.3" @@ -1208,6 +1232,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +dependencies = [ + "equivalent", + "hashbrown 0.14.1", +] + [[package]] name = "instant" version = "0.1.12" @@ -1708,7 +1742,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" dependencies = [ "base64", - "indexmap", + "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", @@ -2058,9 +2092,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] @@ -2083,7 +2117,7 @@ version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" dependencies = [ - "indexmap", + "indexmap 1.9.3", "itoa", "ryu", "serde", @@ -2358,9 +2392,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" dependencies = [ "serde", "serde_spanned", @@ -2370,20 +2404,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.9" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d964908cec0d030b812013af25a0e57fddfadb1e066ecc6681d86253129d4f" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -2803,9 +2837,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.6" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index b32cda4..950b999 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,15 +12,15 @@ license = "AGPL-3.0-or-later" [dependencies] actix-web = "4.4" actix-files = "0.6" -cached = { version = "0.45", features = ["async"] } +cached = { version = "0.46", features = ["async"] } ramhorns = "0.14" -toml = "0.7" +toml = "0.8" serde = { version = "1.0", features = ["derive"] } serde_yaml = "0.9" minify-html = "0.11" minify-js = "0.5" glob = "0.3" -comrak = "0.18" +comrak = "0.19" reqwest = { version = "0.11", features = ["json"] } chrono = "0.4.30" chrono-tz = "0.8" diff --git a/src/misc/markdown.rs b/src/misc/markdown.rs index aa670f1..82e19e0 100644 --- a/src/misc/markdown.rs +++ b/src/misc/markdown.rs @@ -1,9 +1,6 @@ use crate::misc::date::Date; use comrak::nodes::{AstNode, NodeValue}; -use comrak::{ - format_html, parse_document, Arena, ComrakExtensionOptions, ComrakOptions, ComrakParseOptions, - ComrakRenderOptions, ListStyleType, -}; +use comrak::{format_html, parse_document, Arena, ComrakOptions, ListStyleType}; use ramhorns::Content; use serde::{Deserialize, Deserializer}; use std::fs; @@ -55,35 +52,36 @@ pub struct File { /// Options used for parser and compiler MD --> HTML pub fn get_options() -> ComrakOptions { - ComrakOptions { - extension: ComrakExtensionOptions { - strikethrough: true, - tagfilter: true, - table: true, - autolink: true, - tasklist: true, - superscript: true, - header_ids: Some(String::new()), - footnotes: true, - description_lists: true, - front_matter_delimiter: Some("---".into()), - }, - parse: ComrakParseOptions { - smart: true, // could be boring - default_info_string: Some("plaintext".into()), - relaxed_tasklist_matching: true, - }, - render: ComrakRenderOptions { - 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, - list_style: ListStyleType::Dash, - sourcepos: false, - }, - } + let mut options = comrak::Options::default(); + + // Extension + options.extension.strikethrough = true; + options.extension.tagfilter = true; + options.extension.table = true; + options.extension.autolink = true; + options.extension.tasklist = true; + options.extension.superscript = true; + options.extension.header_ids = Some(String::new()); + options.extension.footnotes = true; + options.extension.description_lists = true; + options.extension.front_matter_delimiter = Some("---".into()); + + // Parser + options.parse.smart = true; // could be boring + options.parse.default_info_string = Some("plaintext".into()); + options.parse.relaxed_tasklist_matching = true; + + // Renderer + options.render.hardbreaks = false; // could be true? change by metadata could be good for compatibility + options.render.github_pre_lang = false; + options.render.full_info_string = true; + options.render.width = 0; // 0 mean disabled? + options.render.unsafe_ = true; + options.render.escape = false; + options.render.list_style = ListStyleType::Dash; + options.render.sourcepos = false; + + options } /// Transform markdown string to File structure