Skip to content

Commit e75967c

Browse files
authored
Merge pull request #1206 from rust-lang/renovate/comrak-0.x
Update Rust crate comrak to v0.20.0
2 parents 37c08a6 + 389bd74 commit e75967c

File tree

3 files changed

+84
-16
lines changed

3 files changed

+84
-16
lines changed

Cargo.lock

Lines changed: 75 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ serde = "=1.0.195"
1717
serde_derive = "=1.0.195"
1818
serde_yaml = "=0.9.30"
1919
serde_json = "=1.0.111"
20-
comrak = "=0.17.1"
20+
comrak = "=0.20.0"
2121
rayon = "=1.8.0"
2222
regex = "=1.10.2"
2323
sass-rs = "=0.2.2"

src/posts.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use super::blogs::Manifest;
2-
use comrak::{ComrakExtensionOptions, ComrakOptions, ComrakRenderOptions};
32
use regex::Regex;
43
use serde_derive::{Deserialize, Serialize};
54
use std::path::{Path, PathBuf};
@@ -68,18 +67,14 @@ impl Post {
6867
layout,
6968
} = serde_yaml::from_str(yaml)?;
7069
// next, the contents. we add + to get rid of the final "---\n\n"
71-
let options = ComrakOptions {
72-
render: ComrakRenderOptions {
73-
unsafe_: true, // Allow rendering of raw HTML
74-
..ComrakRenderOptions::default()
75-
},
76-
extension: ComrakExtensionOptions {
77-
header_ids: Some(String::new()),
78-
footnotes: true,
79-
table: true,
80-
..ComrakExtensionOptions::default()
81-
},
82-
..ComrakOptions::default()
70+
let options = comrak::Options {
71+
render: comrak::RenderOptionsBuilder::default().unsafe_(true).build()?,
72+
extension: comrak::ExtensionOptionsBuilder::default()
73+
.header_ids(Some(String::new()))
74+
.footnotes(true)
75+
.table(true)
76+
.build()?,
77+
..comrak::Options::default()
8378
};
8479

8580
// Content starts after "---\n" (we don't assume an extra newline)

0 commit comments

Comments
 (0)