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

@flisk-sh/md2html

v0.1.0

Published

GitHub-flavored Markdown, including the HTML READMEs carry, to HTML that is safe to put in a page. markdown-it plus sanitize-html, configured and tested.

Readme

md2html

GitHub-flavored Markdown, including the HTML that READMEs carry, to HTML that is safe to put in a page.

import { renderMarkdown } from '@flisk-sh/md2html';

const html = renderMarkdown(readme, { baseUrl: 'https://github.com/owner/repo/blob/main/README.md' });

It is not a new parser. It is markdown-it for rendering and sanitize-html for safety, configured the way GitHub renders a README, plus tests that pin it down:

  • GitHub flavor: tables (with align), strikethrough, autolinks, task lists, heading ids like GitHub's (#getting-started, #getting-started-1), and alerts (> [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION]).
  • README HTML: <p align="center">, <picture> and <source>, badges, <details>, <sub>, <kbd> and tables written in HTML render as HTML, not as escaped text.
  • Safe: an allowlist of tags and attributes; no scripts, styles, frames, forms, event handlers or javascript:/data: URLs; protocol-relative URLs dropped; external links get target="_blank" rel="noopener noreferrer".
  • Repository-aware URLs: with baseUrl set to a file on GitHub, relative links resolve to that file's folder and relative images to raw.githubusercontent.com.

API

| Function | Does | | --- | --- | | renderMarkdown(src, { baseUrl?, imageBaseUrl?, headingIds? }) | Markdown to sanitized HTML | | markdownToText(src) | Markdown to plain text, for summaries and search | | slug(text) | GitHub's heading slug | | githubRawUrl(url) | A github.com/.../blob/... URL as its raw.githubusercontent.com URL | | resolveUrl(href, base) | A link resolved the way renderMarkdown does |

Install

From GitHub, pinned to a tag:

bun add github:flisk-sh/md2html#v0.1.0

Checks

bun run test runs the unit tests, the injection tests and the fixture tests: real READMEs in tests/fixtures/ must render with no HTML left escaped, nothing executable, and only absolute URLs. CI runs them, the typecheck and a check that dist/ matches src/ on every push.

Used by Helpdock. MIT.