Skip to main content

parse_frontmatter

Function parse_frontmatter 

Source
pub fn parse_frontmatter(source: &str) -> (Option<ShapeProject>, &str)
Expand description

Parse optional front-matter from a Shape source string.

Returns (config, remaining_source) where config is Some if a --- delimited TOML block was found, and remaining_source is the Shape code after the front-matter (or the full source if none).

This is the backwards-compatible version. For validation diagnostics, use parse_frontmatter_validated instead.

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