pub struct FrontMatterUtils;Expand description
Utility functions for detecting and handling front matter in Markdown documents
Implementations§
Source§impl FrontMatterUtils
impl FrontMatterUtils
Sourcepub fn is_in_front_matter(content: &str, line_num: usize) -> bool
pub fn is_in_front_matter(content: &str, line_num: usize) -> bool
Check if a line is inside front matter content
Sourcepub fn has_front_matter_field(content: &str, field_prefix: &str) -> bool
pub fn has_front_matter_field(content: &str, field_prefix: &str) -> bool
Check if a content contains front matter with a specific field
Sourcepub fn get_front_matter_field_value<'a>(
content: &'a str,
field_name: &str,
) -> Option<&'a str>
pub fn get_front_matter_field_value<'a>( content: &'a str, field_name: &str, ) -> Option<&'a str>
Get the value of a specific front matter field
Sourcepub fn extract_front_matter_fields(content: &str) -> HashMap<String, String>
pub fn extract_front_matter_fields(content: &str) -> HashMap<String, String>
Extract all front matter fields as a HashMap
Sourcepub fn extract_front_matter<'a>(content: &'a str) -> Vec<&'a str>
pub fn extract_front_matter<'a>(content: &'a str) -> Vec<&'a str>
Extract the front matter content as a vector of lines
Sourcepub fn detect_front_matter_type(content: &str) -> FrontMatterType
pub fn detect_front_matter_type(content: &str) -> FrontMatterType
Detect the type of front matter in the content
Sourcepub fn get_front_matter_end_line(content: &str) -> usize
pub fn get_front_matter_end_line(content: &str) -> usize
Get the line number where front matter ends (or 0 if no front matter)
Sourcepub fn fix_malformed_front_matter(content: &str) -> String
pub fn fix_malformed_front_matter(content: &str) -> String
Fix malformed front matter
Auto Trait Implementations§
impl Freeze for FrontMatterUtils
impl RefUnwindSafe for FrontMatterUtils
impl Send for FrontMatterUtils
impl Sync for FrontMatterUtils
impl Unpin for FrontMatterUtils
impl UnwindSafe for FrontMatterUtils
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