pub struct FrontMatterUtils;Expand description
Utility functions for detecting and handling front matter in Markdown documents
Implementations§
Source§impl FrontMatterUtils
impl FrontMatterUtils
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)
Re-scans the whole content. LintContext::new calls this once per
document and caches the result; everything downstream of a
LintContext must read ctx.front_matter_end_line() instead
(enforced via disallowed-methods in clippy.toml).
Auto Trait Implementations§
impl Freeze for FrontMatterUtils
impl RefUnwindSafe for FrontMatterUtils
impl Send for FrontMatterUtils
impl Sync for FrontMatterUtils
impl Unpin for FrontMatterUtils
impl UnsafeUnpin 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