metadata_gen::metadata

Function extract_metadata

Source
pub fn extract_metadata(content: &str) -> Result<Metadata, MetadataError>
Expand description

Extracts metadata from the content string.

This function attempts to extract metadata from YAML, TOML, or JSON formats.

§Arguments

  • content - A string slice containing the content to extract metadata from.

§Returns

A Result containing the extracted Metadata if successful, or a MetadataError if extraction fails.

§Errors

Returns a MetadataError::ExtractionError if no valid front matter is found.