A fast, zero-dependency frontmatter parser built with Bun's native APIs. Supports YAML, TOML, and JSON frontmatter. bun-matter is a drop-in replacement for gray-matter.
Inspired by and based on gray-matter by Jon Schlinkert.
Coming soon
bun add bun-matterbun-matter exposes the same public API as gray-matter, making it easy to switch.
import matter from 'bun-matter';
const file = `
---
title: Hello World
date: 2025-12-22
---
# Content
`;
const parsed = matter(file);
console.log(parsed.data); // { title: 'Hello World', date: '2025-12-22' }
console.log(parsed.content); // "# Content"bun-matter intentionally does not support:
- CSON front-matter
- Coffeescript front-matter
- JavaScript front-matter parsing
If you need these formats, consider using gray-matter.
To install dependencies:
bun installTo run:
bun run src/index.ts