pub struct FrontmatterParser;Expand description
Parses YAML frontmatter from markdown files
Implementations§
Source§impl FrontmatterParser
impl FrontmatterParser
Sourcepub fn extract(content: &str) -> Option<&str>
pub fn extract(content: &str) -> Option<&str>
Extract frontmatter content from a markdown file
Frontmatter is delimited by --- at the start and end.
Returns None if no valid frontmatter is found.
§Example
ⓘ
let content = "---\nname: test\n---\n# Content";
let frontmatter = FrontmatterParser::extract(content);
assert_eq!(frontmatter, Some("name: test\n"));Auto Trait Implementations§
impl Freeze for FrontmatterParser
impl RefUnwindSafe for FrontmatterParser
impl Send for FrontmatterParser
impl Sync for FrontmatterParser
impl Unpin for FrontmatterParser
impl UnwindSafe for FrontmatterParser
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