Skip to content

Function: parseMarkdownFrontmatter() ​

ts
function parseMarkdownFrontmatter(rawMarkdown): ParsedMarkdownDocument;

Defined in: markdown/src/parser/internal/parse-markdown-frontmatter.ts:21

Parses leading YAML frontmatter and body content from a raw Markdown string via mdast and yaml.

Uses mdast-util-from-markdown with micromark-extension-frontmatter and mdast-util-frontmatter to isolate the leading yaml AST node and parses its contents via yaml.parse.

Parameters ​

ParameterTypeDescription
rawMarkdownstringRaw UTF-8 Markdown document text.

Returns ​

ParsedMarkdownDocument

Frozen ParsedMarkdownDocument containing frontmatter and body.

Released under the MIT License.