npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

frontmatter-md

v1.0.3

Published

Lightweight YAML frontmatter parser for Markdown files.

Readme

frontmatter-md

npm version npm downloads jsDelivr license

Lightweight YAML frontmatter parser for Markdown files. The package extracts metadata written at the beginning of a Markdown file between --- delimiters and returns the remaining document content.

Do you have questions or want to receive notifications about important changes or new features in my repositories? Join my Discord server! If you do not use Discord, you can also open an issue on GitHub.

If you like this repository, leave a star ⭐. Thank you!

Installation

npm install frontmatter-md

Node.js usage

Markdown

---
title: "Hello World"
description: Simple post showing supported data types
author: Sefinek
order: 3
rating: 4.5
draft: false
featured: true
tags: [markdown, frontmatter, parser]
categories:
  - JavaScript
  - Markdown
  - Tools
---

# Heading
The document content is returned separately, without the frontmatter block.

Example

const parseFrontmatter = require('frontmatter-md');

const { data, content } = parseFrontmatter(markdown);

Output

{
	"data": {
		"title": "Hello World",
		"description": "Simple post showing supported data types",
		"author": "Sefinek",
		"order": 3,
		"rating": 4.5,
		"draft": false,
		"featured": true,
		"tags": ["markdown", "frontmatter", "parser"],
		"categories": ["JavaScript", "Markdown", "Tools"]
	},
	"content": "# Heading\nThe document content is returned separately, without the frontmatter block."
}

Browser usage

URL

https://cdn.jsdelivr.net/npm/frontmatter-md@1/dist/mdFrontmatter.min.js

Example

<script src="https://cdn.jsdelivr.net/npm/frontmatter-md@1/dist/mdFrontmatter.min.js"></script>
<script>
	const markdown = `---
title: Browser example
tags: [html, browser, markdown]
draft: false
---

# Browser example
Parsed directly in the browser.`;

	const { data, content } = mdFrontmatter(markdown);
	console.log(data);
	console.log(content);
</script>

Supported values

  • strings, including quoted strings
  • numbers
  • true and false values
  • YAML lists
  • inline arrays, e.g. [foo, bar, baz]
  • comments and empty lines inside the frontmatter block

API

const result = parseFrontmatter(markdown);

The function returns an object:

{
	data: {},   // Metadata from frontmatter
	content: '' // Markdown content without frontmatter
}

If the text does not contain valid frontmatter, data will be an empty object and content will remain unchanged.

Development

npm test
npm run lint
npm run build

MIT License

Copyright © 2026 Sefinek