pub struct MarkdownFormatter { /* private fields */ }Expand description
Used to format Markdown inputs.
To get a MarkdownFormatter use FormatterBuilder::build
Implementations§
Source§impl MarkdownFormatter
impl MarkdownFormatter
Sourcepub fn format(self, input: &str) -> Result<String, Error>
pub fn format(self, input: &str) -> Result<String, Error>
Format Markdown input
let builder = FormatterBuilder::default();
let formatter = builder.build();
let input = " # Header! ";
let rewrite = formatter.format(input).unwrap();
assert_eq!(rewrite, String::from("# Header!"));Sourcepub fn format_with_paragraph_and_html_block_formatter<P, H>(
self,
input: &str,
) -> Result<String, Error>where
P: ParagraphFormatter,
H: ParagraphFormatter,
pub fn format_with_paragraph_and_html_block_formatter<P, H>(
self,
input: &str,
) -> Result<String, Error>where
P: ParagraphFormatter,
H: ParagraphFormatter,
Format Markdown input with the given ParagraphFormatter P to
format paragraphs, and H to format HTML blocks.
let builder = FormatterBuilder::default();
let formatter = builder.build();
let input = " # Header! ";
let rewrite = formatter
.format_with_paragraph_and_html_block_formatter::<Paragraph, PreservingHtmlBlock>(input)
.unwrap();
assert_eq!(rewrite, String::from("# Header!"));Auto Trait Implementations§
impl Freeze for MarkdownFormatter
impl !RefUnwindSafe for MarkdownFormatter
impl !Send for MarkdownFormatter
impl !Sync for MarkdownFormatter
impl Unpin for MarkdownFormatter
impl !UnwindSafe for MarkdownFormatter
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more