# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4
[[package]]
name = "adler"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
+name = "bitflags"
+version = "2.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
+
+[[package]]
name = "block-buffer"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"clap_derive",
"clap_lex",
"is-terminal",
"proc-macro-error",
"proc-macro2",
"quote",
- "syn",
+ "syn 1.0.107",
]
[[package]]
"proc-macro2",
"quote",
"scratch",
- "syn",
+ "syn 1.0.107",
]
[[package]]
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 1.0.107",
]
[[package]]
[[package]]
name = "fancy-regex"
-version = "0.7.1"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf"
+checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2"
dependencies = [
"bit-set",
"regex",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"libc",
"libgit2-sys",
"log",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"ignore",
"walkdir",
]
]
[[package]]
+name = "highlight-pulldown"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1eb649350bc7d5e1b8770777d0ae848357ae685f09c112b8b9102a10acffa5d6"
+dependencies = [
+ "pulldown-cmark",
+ "syntect",
+ "thiserror",
+]
+
+[[package]]
name = "humansize"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
"flate2",
"git2",
"glob",
+ "highlight-pulldown",
"open",
"pulldown-cmark",
"rayon",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"libc",
"once_cell",
"onig_sys",
"pest_meta",
"proc-macro2",
"quote",
- "syn",
+ "syn 1.0.107",
]
[[package]]
"proc-macro-error-attr",
"proc-macro2",
"quote",
- "syn",
+ "syn 1.0.107",
"version_check",
]
[[package]]
name = "proc-macro2"
-version = "1.0.49"
+version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
+checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
dependencies = [
"unicode-ident",
]
[[package]]
name = "pulldown-cmark"
-version = "0.9.2"
+version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63"
+checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
dependencies = [
- "bitflags",
+ "bitflags 2.8.0",
"getopts",
"memchr",
"unicase",
[[package]]
name = "quote"
-version = "1.0.23"
+version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
+checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
dependencies = [
"proc-macro2",
]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
]
[[package]]
dependencies = [
"aho-corasick",
"memchr",
- "regex-syntax",
+ "regex-syntax 0.6.28",
]
[[package]]
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
+name = "regex-syntax"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
+
+[[package]]
name = "rustix"
version = "0.36.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"errno",
"io-lifetimes",
"libc",
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 1.0.107",
]
[[package]]
]
[[package]]
+name = "syn"
+version = "2.0.96"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
name = "syntect"
-version = "5.0.0"
+version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8"
+checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1"
dependencies = [
"bincode",
- "bitflags",
+ "bitflags 1.3.2",
"fancy-regex",
"flate2",
"fnv",
- "lazy_static",
"once_cell",
"onig",
"plist",
- "regex-syntax",
+ "regex-syntax 0.8.5",
"serde",
"serde_derive",
"serde_json",
[[package]]
name = "thiserror"
-version = "1.0.38"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.38"
+version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.96",
]
[[package]]
"once_cell",
"proc-macro2",
"quote",
- "syn",
+ "syn 1.0.107",
"wasm-bindgen-shared",
]
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 1.0.107",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
default = ["markdown", "highlight"]
markdown = ["dep:pulldown-cmark"]
highlight_fast = ["syntect/default-onig"]
-highlight = ["syntect/default-fancy"]
+highlight = ["syntect/default-fancy", "syntect/yaml-load"]
[dependencies]
chrono = { version = "0.4.23", features=["clock"] }
clap = { version="4.0.32", features=["derive"] }
git2 = "0.15.0"
glob = "0.3.1"
+highlight-pulldown = "0.2.2"
open = "3.2.0"
pulldown-cmark = { version = "0.9.2", optional = true }
rayon = "1.6.1"
serde = { version = "1.0.152", features = ["derive"] }
-syntect = { version = "5.0.0", default-features = false, optional = true }
+syntect = { version = "5.2.0", default-features = false, optional = true }
tera = "1.17.1"
toml = "0.5.10"
}
#[cfg(feature = "markdown")]
- fn parse_markdown(contents: &str) -> String {
+ fn parse_markdown(contents: &str, theme: &str) -> String {
let mut options = Options::empty();
options.insert(Options::ENABLE_STRIKETHROUGH);
options.insert(Options::ENABLE_TABLES);
let parser = MdParser::new_ext(contents, options);
+ let events: Vec<pulldown_cmark::Event> = parser.into_iter().collect();
+ #[cfg(any(feature = "highlight", feature = "highlight_fast"))]
+ let events = match highlight_pulldown::highlight_with_theme(events.clone().into_iter(), theme) {
+ Ok(e) => e,
+ _ => events,
+ };
let mut html_output: String = String::with_capacity(contents.len() * 3 / 2);
- html::push_html(&mut html_output, parser);
+ html::push_html(&mut html_output, events.into_iter());
html_output
}
#[cfg(feature = "markdown")]
Some(x) if settings.render_markdown.unwrap_or(false) && x == "md" => {
loudest!(" - rendering Markdown in {}", path.display());
- let (cstr, rendered, pre) = (GitsyGenerator::parse_markdown(&cstr), true, false);
+ let theme = settings
+ .syntax_highlight_theme
+ .as_deref()
+ .unwrap_or("base16-ocean.dark");
+ let (cstr, rendered, pre) = (GitsyGenerator::parse_markdown(&cstr, &theme), true, false);
(cstr, rendered, pre)
}
#[cfg(any(feature = "highlight", feature = "highlight_fast"))]