Struct comrak::ParseOptionsBuilder
source · pub struct ParseOptionsBuilder { /* private fields */ }
Expand description
Builder for ParseOptions
.
Implementations§
source§impl ParseOptionsBuilder
impl ParseOptionsBuilder
sourcepub fn smart(&mut self, value: bool) -> &mut Self
pub fn smart(&mut self, value: bool) -> &mut Self
Punctuation (quotes, full-stops and hyphens) are converted into ‘smart’ punctuation.
let mut options = Options::default();
assert_eq!(markdown_to_html("'Hello,' \"world\" ...", &options),
"<p>'Hello,' "world" ...</p>\n");
options.parse.smart = true;
assert_eq!(markdown_to_html("'Hello,' \"world\" ...", &options),
"<p>‘Hello,’ “world” …</p>\n");
sourcepub fn default_info_string(&mut self, value: Option<String>) -> &mut Self
pub fn default_info_string(&mut self, value: Option<String>) -> &mut Self
The default info string for fenced code blocks.
let mut options = Options::default();
assert_eq!(markdown_to_html("```\nfn hello();\n```\n", &options),
"<pre><code>fn hello();\n</code></pre>\n");
options.parse.default_info_string = Some("rust".into());
assert_eq!(markdown_to_html("```\nfn hello();\n```\n", &options),
"<pre><code class=\"language-rust\">fn hello();\n</code></pre>\n");
sourcepub fn relaxed_tasklist_matching(&mut self, value: bool) -> &mut Self
pub fn relaxed_tasklist_matching(&mut self, value: bool) -> &mut Self
Whether or not a simple x
or X
is used for tasklist or any other symbol is allowed.
sourcepub fn relaxed_autolinks(&mut self, value: bool) -> &mut Self
pub fn relaxed_autolinks(&mut self, value: bool) -> &mut Self
Relax parsing of autolinks, allowing links to be detected inside brackets.
let mut options = Options::default();
options.extension.autolink = true;
assert_eq!(markdown_to_html("[https://foo.com]", &options),
"<p>[https://foo.com]</p>\n");
options.parse.relaxed_autolinks = true;
assert_eq!(markdown_to_html("[https://foo.com]", &options),
"<p>[<a href=\"https://foo.com\">https://foo.com</a>]</p>\n");
sourcepub fn build(&self) -> Result<ParseOptions, ParseOptionsBuilderError>
pub fn build(&self) -> Result<ParseOptions, ParseOptionsBuilderError>
Trait Implementations§
source§impl Clone for ParseOptionsBuilder
impl Clone for ParseOptionsBuilder
source§fn clone(&self) -> ParseOptionsBuilder
fn clone(&self) -> ParseOptionsBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for ParseOptionsBuilder
impl Send for ParseOptionsBuilder
impl Sync for ParseOptionsBuilder
impl Unpin for ParseOptionsBuilder
impl UnwindSafe for ParseOptionsBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more