update comrak
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending approval

This commit is contained in:
Mylloon 2024-07-12 17:52:38 +02:00
parent 5b43730150
commit 485797c64f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 25 additions and 4 deletions

15
Cargo.lock generated
View file

@ -604,6 +604,16 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade8366b8bd5ba243f0a58f036cc0ca8a2f069cff1a2351ef1cac6b083e16fc0"
[[package]]
name = "caseless"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "808dab3318747be122cb31d36de18d4d1c81277a76f8332a02b81a3d73463d7f"
dependencies = [
"regex",
"unicode-normalization",
]
[[package]]
name = "cc"
version = "1.0.98"
@ -699,10 +709,11 @@ checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
[[package]]
name = "comrak"
version = "0.24.1"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a972c8ec1be8065f7b597b5f7f5b3be535db780280644aebdcd1966decf58dc"
checksum = "777213abd0d8d131953e66f72837f3298dcba9ca9ade0fb1ab8f16ee4aa867dc"
dependencies = [
"caseless",
"clap",
"derive_builder",
"entities",

View file

@ -21,7 +21,7 @@ serde_json = "1.0"
minify-html = "0.15"
minify-js = "0.6"
glob = "0.3"
comrak = "0.24"
comrak = "0.25"
reqwest = { version = "0.12", features = ["json"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock"]}
chrono-tz = "0.9"

View file

@ -122,7 +122,7 @@ pub struct File {
}
/// Options used for parser and compiler MD --> HTML
pub fn get_options() -> ComrakOptions {
pub fn get_options<'a>() -> ComrakOptions<'a> {
let mut options = comrak::Options::default();
// Extension
@ -139,12 +139,18 @@ pub fn get_options() -> ComrakOptions {
options.extension.multiline_block_quotes = true;
options.extension.math_dollars = true;
options.extension.math_code = false;
options.extension.wikilinks_title_after_pipe = false;
options.extension.wikilinks_title_before_pipe = false;
options.extension.underline = true;
options.extension.spoiler = false;
options.extension.greentext = true;
// Parser
options.parse.smart = true; // could be boring
options.parse.default_info_string = Some("plaintext".into());
options.parse.relaxed_tasklist_matching = true;
options.parse.relaxed_autolinks = true;
// options.render.broken_link_callback = ...;
// Renderer
options.render.hardbreaks = false; // could be true? change by metadata could be good for compatibility
@ -156,6 +162,10 @@ pub fn get_options() -> ComrakOptions {
options.render.list_style = ListStyleType::Dash;
options.render.sourcepos = false;
options.render.escaped_char_spans = false;
options.render.ignore_setext = true;
options.render.ignore_empty_links = true;
options.render.gfm_quirks = true;
options.render.prefer_fenced = false;
options
}