Improve rendering performance

pull/1/head
trivernis 4 years ago
parent 9e1d13bce5
commit 03ebed6277

2
Cargo.lock generated

@ -444,7 +444,7 @@ dependencies = [
[[package]]
name = "snekdown"
version = "0.2.2"
version = "0.2.3"
dependencies = [
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",

@ -1,6 +1,6 @@
[package]
name = "snekdown"
version = "0.2.2"
version = "0.2.3"
authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018"
license-file = "LICENSE"

@ -97,9 +97,8 @@ impl ToHtml for Section {
fn to_html(&self) -> String {
let inner = self
.elements
.par_iter()
.map(|e| e.to_html())
.reduce(|| "".to_string(), |a, b| format!("{}{}", a, b));
.iter()
.fold("".to_string(), |a, b| format!("{}{}", a, b.to_html()));
format!("<section>{}{}</section>", self.header.to_html(), inner)
}
}

Loading…
Cancel
Save