This site provides a machine-readable index at /llms.txt.

Skip to main content Skip to navigation

FrontMatterParser Pennington.FrontMatter

Parses YAML front matter from markdown content.

Constructors

.ctor

#
public FrontMatterParser();

Initializes the parser with a camelCase YAML deserializer that matches keys case-insensitively and ignores unmatched properties. Title:, title:, and TITLE: all bind to the same property.

Methods

DeserializeYaml<T>

#
public T DeserializeYaml<T>(string yaml) where T : IFrontMatter, new();

Deserialize raw YAML content (no --- delimiters) into a front matter type. Used for sidecar metadata files.

Parameters

yaml string

Returns

T

Parse<T>

#
public FrontMatterResult<T> Parse<T>(string content) where T : IFrontMatter, new();

Parse front matter and return the metadata + remaining markdown body. Returns null metadata if no front matter block is present.

Parameters

content string

Returns

FrontMatterResult<T>

Pennington.FrontMatter.FrontMatterParser

namespace Pennington.FrontMatter;

/// Parses YAML front matter from markdown content.
public class FrontMatterParser
{
    /// Initializes the parser with a camelCase YAML deserializer that matches keys case-insensitively and ignores unmatched properties. Title:, title:, and TITLE: all bind to the same property.
    
public FrontMatterParser();
/// Deserialize raw YAML content (no --- delimiters) into a front matter type. Used for sidecar metadata files.
public T DeserializeYaml<T>(string yaml) where T : IFrontMatter, new();
/// Parse front matter and return the metadata + remaining markdown body. Returns null metadata if no front matter block is present.
public FrontMatterResult<T> Parse<T>(string content) where T : IFrontMatter, new();
}