Markdown
The MD class provides a set of utilities to work with Markdown and frontmatter text.
The parser also supports markdown variants like MDX.
frontmatter
Section titled “frontmatter”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")content
Section titled “content”Extracts the markdown source without the frontmatter.
const content = MD.content(text)updateFrontmatter
Section titled “updateFrontmatter”Merges frontmatter values into the existing markdown file. Use null value to delete fields.
const updated = MD.updateFrontmatter(text, { title: "New Title" })