pub struct Formatter<'a> { /* private fields */ }Expand description
A Formatter is needed to format markdown. It is created and customized as
needed using the with_* methods.
Once created, the format_cmark or format_cmark_writer methods can be
used.
Implementations§
source§impl<'a> Formatter<'a>
impl<'a> Formatter<'a>
sourcepub fn format_cmark(&self, input: &str) -> String
pub fn format_cmark(&self, input: &str) -> String
Format markdown, returning the formatted result as a String.
sourcepub fn format_cmark_writer<W: Write>(&self, input: &str, w: W) -> Result
pub fn format_cmark_writer<W: Write>(&self, input: &str, w: W) -> Result
Format markdown, writing the result to the provided Writer.
sourcepub fn with_code_formatter(self, code_fmt: Option<CodeFormatFn<'a>>) -> Self
pub fn with_code_formatter(self, code_fmt: Option<CodeFormatFn<'a>>) -> Self
Sets the Formatters code formatter function. By default, code blocks
are not formatted.
sourcepub fn with_blockquote(self, blockquote: &'a str) -> Self
pub fn with_blockquote(self, blockquote: &'a str) -> Self
Sets the blockquote string. Default: “>”.
sourcepub fn with_emphasis(self, emphasis: &'a str) -> Self
pub fn with_emphasis(self, emphasis: &'a str) -> Self
Sets the emphasis string. Default: “_”.
sourcepub fn with_unordered_list(self, unordered_list: &'a str) -> Self
pub fn with_unordered_list(self, unordered_list: &'a str) -> Self
Sets the unordered list string. Default: “-”.