Parses YAML frontmatter from MDX file content
Raw MDX file content with YAML frontmatter
Object containing parsed metadata and content body
const mdx = `---title: Hello WorldpublishedAt: 2025-01-01summary: My first post---# Content here`const { metadata, content } = parseFrontmatter(mdx)// metadata: { title: "Hello World", publishedAt: "2025-01-01", summary: "My first post" }// content: "# Content here" Copy
const mdx = `---title: Hello WorldpublishedAt: 2025-01-01summary: My first post---# Content here`const { metadata, content } = parseFrontmatter(mdx)// metadata: { title: "Hello World", publishedAt: "2025-01-01", summary: "My first post" }// content: "# Content here"
Parses YAML frontmatter from MDX file content