Skip to main content

Function: extractFrontmatter()

function extractFrontmatter(text: string): Readonly<{
body: string;
content: string;
data: Readonly<UnknownRecord>;
error: string | undefined;
offset: number;
}> | null;

Defined in: _internal/frontmatter.ts:35

Extract and safely parse top-of-file YAML frontmatter when present.

Parameters​

ParameterType
textstring

Returns​

| Readonly<{ body: string; content: string; data: Readonly<UnknownRecord>; error: string | undefined; offset: number; }> | null