Skip to content

Commit 8dbb2b6

Browse files
committed
comrak: Use new builder() helpers
1 parent b30a1cd commit 8dbb2b6

File tree

1 file changed

+15
-12
lines changed
  • crates/crates_io_markdown

1 file changed

+15
-12
lines changed

crates/crates_io_markdown/lib.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use ammonia::{Builder, UrlRelative, UrlRelativeEvaluate};
44
use comrak::nodes::{AstNode, NodeValue};
5+
use comrak::ComrakOptions;
56
use htmlescape::encode_minimal;
67
use std::borrow::Cow;
78
use std::path::Path;
@@ -71,18 +72,20 @@ impl<'a> MarkdownRenderer<'a> {
7172
ComrakRenderOptions,
7273
};
7374

74-
let mut render_options = ComrakRenderOptions::default();
75-
// The output will be sanitized with `ammonia`
76-
render_options.unsafe_ = true;
77-
78-
let mut extension_options = ComrakExtensionOptions::default();
79-
extension_options.autolink = true;
80-
extension_options.strikethrough = true;
81-
extension_options.table = true;
82-
extension_options.tagfilter = true;
83-
extension_options.tasklist = true;
84-
extension_options.header_ids = Some("user-content-".to_string());
85-
extension_options.footnotes = true;
75+
let render_options = ComrakRenderOptions::builder()
76+
// The output will be sanitized with `ammonia`
77+
.unsafe_(true)
78+
.build();
79+
80+
let extension_options = ComrakExtensionOptions::builder()
81+
.autolink(true)
82+
.strikethrough(true)
83+
.table(true)
84+
.tagfilter(true)
85+
.tasklist(true)
86+
.header_ids("user-content-".to_string())
87+
.footnotes(true)
88+
.build();
8689

8790
let options = ComrakOptions {
8891
render: render_options,

0 commit comments

Comments
 (0)