Skip to main content

parse_frontmatter_validated

Function parse_frontmatter_validated 

Source
pub fn parse_frontmatter_validated(
    source: &str,
) -> (Option<FrontmatterConfig>, Vec<FrontmatterDiagnostic>, &str)
Expand description

Parse optional front-matter from a Shape source string, with validation.

Returns (config, diagnostics, remaining_source) where:

  • config is Some if a --- delimited TOML block was found and parsed
  • diagnostics contains any validation errors/warnings
  • remaining_source is the Shape code after the front-matter

Shebang lines (#!...) at the very start are skipped before checking for front-matter.