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

mikel-frontmatter

v0.33.0

Published

A mikel plugin to define new data inside templates using a frontmatter-like syntax.

Readme

mikel-frontmatter

npm version license

A mikel plugin to define new data inside templates using a frontmatter-like syntax. Supports YAML, JSON, and TOML formats.

Installation

You can install it via npm or yarn:

## Install using npm
$ npm install mikel mikel-frontmatter

## Install using yarn
$ yarn add mikel mikel-frontmatter

Usage

Import the mikel-frontmatter package:

import mikel from "mikel";
import mikelFrontmatter from "mikel-frontmatter";

Include the plugin using the use method of mikel:

const m = mikel.create();

m.use(mikelFrontmatter({ ... }));

In your template, the {{#frontmatter}} helper allows you to define metadata at the beginning of your templates, similar to frontmatter in Markdown files. The parsed data is stored as a state variable accessible via @frontmatter (or a custom variable name, see below).

Example:

{{#frontmatter}}
title: My Page Title
author: John Doe
date: 2026-02-03
tags:
  - javascript
  - templating
{{/frontmatter}}
<h1>{{@frontmatter.title}}</h1>
<p>By {{@frontmatter.author}} on {{@frontmatter.date}}</p>
<ul>
    {{#each @frontmatter.tags}}
    <li>{{this}}</li>
    {{/each}}
</ul>

Note that this helper doesn't produce any output in the rendered template.

Customization

The {{#frontmatter}} helper accepts the following arguments:

as

Custom state variable name to save parsed metadata. If not provided, parsed metadata will be saved in @frontmatter. Example:

{{#frontmatter as="meta"}}
name: Bob
{{/frontmatter}}
<div>Hello {{@meta.name}}</div>

format

The format of the frontmatter content. Supported values are yaml (default), json, and toml.

Example using JSON:

{{#frontmatter format="json"}}
{
  "title": "My JSON Page",
  "tags": ["json", "mikel"]
}
{{/frontmatter}}

Example using TOML:

{{#frontmatter format="toml"}}
title = "My TOML Page"
tags = ["toml", "mikel"]

[author]
name = "John Doe"
{{/frontmatter}}

API

mikelFrontmatter(options?)

Creates a new instance of the frontmatter plugin. It accepts an options parameters containing the following fields:

  • parser (Function): Custom parser function to override the default YAML/JSON/TOML parser.

Custom Parser

You can provide a custom parser function if you need special parsing logic:

const customParser = (content, format) => {
    // Your custom parsing logic based on content and format
    return parsedData;
};

const render = mikel.create();
render.use(mikelFrontmatter({
    parser: customParser,
}));

YAML Syntax Support

This plugin includes a basic YAML parser that supports:

  • ✅ Key-value pairs.
  • ✅ Nested objects (with indentation).
  • ✅ Arrays (using - item syntax).
  • ✅ Arrays of objects.
  • ✅ Inline arrays [item1, item2, ...].
  • ✅ Inline objects {key1: value1, key2: value2, ...}.
  • ✅ Boolean variants (yes/no, on/off, true/false).
  • ❌ Multi-line strings (with | or >).
  • ❌ Multi-document syntax (---).
  • ❌ Anchors and aliases (&anchor, *alias).
  • ❌ Complex YAML features (e.g., tags, merge keys).

TOML Support

The plugin includes a basic TOML parser that supports:

  • ✅ Key-value pairs (key = "value").
  • ✅ Tables ([section]).
  • ✅ Nested tables ([section.subsection]).
  • ✅ Array of Tables ([[table]]).
  • ✅ Inline arrays and objects.
  • ✅ Strings, integers, floats, booleans, and null.
  • ✅ Comments (starting with #).
  • ❌ Multi-line strings (""" or ''').
  • ❌ Date and time values.
  • ❌ Dotted keys (e.g. a.b = "val") in a single line.
  • ❌ Hex, octal, binary, and scientific notation.

JSON Support

The plugin fully supports standard JSON syntax through the native JSON.parse() method.

License

Licensed under the MIT License.