pub struct MarkdownReader<'a> { /* private fields */ }Available on crate feature
markdown only.Expand description
Streaming Markdown reader. Available when the markdown feature is enabled.
A streaming Markdown reader that implements EventSource.
MarkdownReader parses Markdown using pulldown-cmark and emits DocSpec events
one at a time. It handles the mapping from pulldown-cmark’s event model to DocSpec’s
event model, including tracking inline formatting state.
§Example
use docspec_markdown_reader::{MarkdownReader, EventSource};
let mut reader = MarkdownReader::new("**bold** and *italic*");
while let Some(event) = reader.next_event()? {
// Process events...
}Implementations§
Source§impl<'a> MarkdownReader<'a>
impl<'a> MarkdownReader<'a>
Sourcepub fn new(markdown: &'a str) -> MarkdownReader<'a>
pub fn new(markdown: &'a str) -> MarkdownReader<'a>
Creates a new MarkdownReader from the given Markdown string.
The reader will emit StartDocument as its first event and EndDocument
as its last event, with the parsed content events in between.
§Example
use docspec_markdown_reader::MarkdownReader;
let reader = MarkdownReader::new("# Hello World");Trait Implementations§
Source§impl EventSource for MarkdownReader<'_>
impl EventSource for MarkdownReader<'_>
Auto Trait Implementations§
impl<'a> Freeze for MarkdownReader<'a>
impl<'a> RefUnwindSafe for MarkdownReader<'a>
impl<'a> Send for MarkdownReader<'a>
impl<'a> Sync for MarkdownReader<'a>
impl<'a> Unpin for MarkdownReader<'a>
impl<'a> UnsafeUnpin for MarkdownReader<'a>
impl<'a> UnwindSafe for MarkdownReader<'a>
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