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

md-spawn

v1.0.0

Published

Browser-native <md-spawn> custom element: render Markdown from src or inline, secure by default.

Downloads

138

Readme

MD-Spawn

Browser-native Markdown as a custom element: drop in <md-spawn>, load one module script, and render remote or inline Markdown with sanitization, syntax highlighting, and a default theme—no build step required.

Quick start

<md-spawn src="./README.md"></md-spawn>
<script type="module" src="./dist/index.js"></script>

Use the path to dist/index.js from your project or CDN. The script registers <md-spawn> automatically.

Inline Markdown (no src):

<md-spawn>
# Hello

**Markdown** here.
</md-spawn>
<script type="module" src="./dist/index.js"></script>

Behavior

| Feature | Details | |--------|---------| | src | Fetches Markdown and renders it. Relative URLs are resolved so paths like ./doc.md work even when the page URL is rewritten (e.g. /demo instead of /demo/index.html). | | Inline | If there is no src, text inside the element is treated as Markdown. | | Fetch failure | If src fails and the tag has inline content, the inline Markdown is used instead. | | loading="lazy" | Defers the first render until the element is near the viewport. | | shadow | Renders inside an open shadow root (isolation). Mode is fixed on first render. | | unsafe | Skips HTML sanitization (XSS risk). Default is sanitized with DOMPurify. |

API (V1)

<md-spawn
  src="./README.md"
  loading="lazy"
  shadow
  unsafe
></md-spawn>

npm

npm install md-spawn
import "md-spawn"; // registers <md-spawn>

Or:

import { defineMdSpawn, MdSpawn, renderMarkdown } from "md-spawn";
defineMdSpawn();

Development

npm install
npm run build    # outputs dist/
npm test         # Vitest
npm run test:e2e # Playwright (builds then serves the repo root)

See demo/README.md for running the demo locally.

Publishing to npm

The name md-spawn is available on the public registry (verify with npm view md-spawn before you publish).

Option A — interactive login

npm login
npm publish

prepublishOnly runs npm run build automatically.

Option B — token in .env

  1. Create an access token under your npm account (Access Tokens), e.g. granular token with Publish for this package.

  2. Put it in .env as NPM_TOKEN=npm_... (see .env.example). Do not commit .env — it is gitignored.

  3. Copy .npmrc.template to .npmrc, load the token, publish:

    cp .npmrc.template .npmrc
    set -a && source .env && set +a   # bash/zsh: exports vars from .env
    npm publish

    Keep .npmrc only if it uses ${NPM_TOKEN} — never commit a literal token.

Security

Default mode strips dangerous HTML/scripts. The unsafe attribute disables sanitization—only use with trusted Markdown.

License

MIT