Skip to content
An 8-bit icon with two rectangles: the top one has three colored horizontal lines representing YAML frontmatter, the bottom features a large stylized “M” for markdown. Abstract arrows point between them to indicate extracting and updating data. The graphic is flat, geometric, 2D, with five solid corporate colors, no people, text, or decorative effects, and measures 128 by 128 pixels.

Markdown

The MD class provides a set of utilities to work with Markdown and frontmatter text.

The parser also supports markdown variants like MDX.

Extracts and parses the frontmatter text from a markdown file. Returns undefined if no frontmatter is found or if parsing fails. The default format is yaml.

const frontmatter = MD.frontmatter(text, "yaml")

Extracts the markdown source without the frontmatter.

const content = MD.content(text)

Merges frontmatter values into the existing markdown file. Use null value to delete fields.

const updated = MD.updateFrontmatter(text, { title: "New Title" })