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

mf2dom

v0.1.12

Published

Render Microformats2 JSON to semantic HTML

Readme

mf2dom

Render Microformats2 JSON to semantic HTML.

Installation

npm install mf2dom

Usage

Browser (ESM)

import { render, renderItems, renderItemElement } from 'mf2dom';

// Render a full mf2 document
const html = render(mf2Document);

// Render multiple items to a DocumentFragment
const fragment = renderItems(items, { topHeading: 2 });
document.querySelector('main').appendChild(fragment);

// Render a single item to an HTMLElement
const element = renderItemElement(item, { topHeading: 2 });

Browser (IIFE)

<script src="https://unpkg.com/mf2dom/dist/mf2dom.min.js"></script>
<script>
  const html = mf2dom.render(mf2Document);
</script>

Node.js

import { render } from 'mf2dom';
import { JSDOM } from 'jsdom';

// Set up global document for Node.js
const dom = new JSDOM('<!DOCTYPE html><html><body></body></html>');
global.document = dom.window.document;

const html = render(mf2Document);

API

render(doc, options?)

Render an mf2 document to HTML.

  • doc: Microformats2 document with items array
  • options.asElement: Return HTMLElement instead of string (default: false)
  • options.topHeading: Starting heading level for names (1-6)

renderItems(items, options?)

Render multiple mf2 items to a DocumentFragment.

  • items: Array of mf2 items
  • options.relUrls: rel-urls from parsed document
  • options.topHeading: Starting heading level

renderItemElement(item, options?)

Render a single mf2 item to an HTMLElement.

  • item: Single mf2 item
  • options.relUrls: rel-urls from parsed document
  • options.topHeading: Starting heading level

Features

  • Renders h-entry, h-card, h-feed, h-event, and other microformat types
  • Semantic HTML output (article, address, time, etc.)
  • Proper heading hierarchy with topHeading option
  • Handles embedded items (author h-cards, location, etc.)
  • Ruby annotations for names with IPA pronunciation
  • Linked names when URL matches
  • Media handling (photo, video, audio)
  • Date/time formatting

License

AGPL-3.0-or-later