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

@wire-lang/markdown

v0.4.0

Published

Remark, rehype, and MDX plugins for rendering wire code fences as inline SVG.

Readme

@wire-lang/markdown

Remark, rehype, and MDX support for fenced wire diagrams. Browser rendering after HTML loads is the default; ahead-of-time SVG rendering is opt-in.

Default: render in the browser

Write a complete Wire source inside a fence:

```wire
schematic
  component R1 Resistor value=220ohm
  component D1 LED color=red
  connect R1.1, D1.A
```

Install @wire-lang/browser and initialize it in your site's client entry point:

import wire from "@wire-lang/browser";

const { errors } = await wire.initialize();
for (const { error } of errors) console.error(error);

The browser discovers standard pre > code.language-wire blocks, renders their source asynchronously, hides the original blocks, and inserts SVG diagrams. Without the runtime, readers see the source code. This does not enable native wire support on hosts where you cannot configure scripts or the Markdown build.

No Wire Markdown plugin is needed if the processor already emits those blocks. remarkWire and rehypeWire default to { mode: "browser" }, which preserves the code nodes for this workflow. Preserve the language-wire class and source text through syntax highlighting. For MDX, run the browser renderer after hydration. See the browser guide for lifecycle and error handling.

Ahead-of-time rendering

npm install @wire-lang/markdown unified remark-parse remark-rehype rehype-stringify

The package is ESM-only and requires Node.js 20 or newer. Pass { mode: "static" } to render during the build, producing inline SVG with no Wire browser runtime:

import { remarkWire } from "@wire-lang/markdown";
import rehypeStringify from "rehype-stringify";
import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import { unified } from "unified";

const html = await unified()
  .use(remarkParse)
  .use(remarkWire, { mode: "static" })
  .use(remarkRehype)
  .use(rehypeStringify)
  .process(markdown);

Alternatively, use .use(rehypeWire, { mode: "static" }) after remarkRehype. Use one Wire plugin per pipeline. Both produce structured HTML nodes without requiring raw HTML support. Default exports are available at @wire-lang/markdown/remark and @wire-lang/markdown/rehype.

For MDX, install @mdx-js/mdx and pass the same option:

import { compile } from "@mdx-js/mdx";
import { rehypeWire } from "@wire-lang/markdown";

const result = await compile(mdx, {
  rehypePlugins: [[rehypeWire, { mode: "static" }]],
});

Static remarkWire replaces code nodes with custom diagram nodes that remark-stringify cannot serialize. If you serialize Markdown first, leave the fences intact and use static rehypeWire in the later HTML build.

If the pipeline sanitizes user-authored HTML, place the sanitizer before static rehypeWire. A sanitizer after static remarkWire needs an SVG-aware schema.

Errors

Other fenced languages are unchanged. In browser mode, invalid source reaches the browser, whose runtime returns errors while continuing with other blocks.

In static mode, fatal Wire diagnostics fail the document build as VFile messages. Line and column point into the original Markdown or MDX file, and cause retains the original WireLangError. Preserve the original VFile text for accurate columns in unevenly indented fences and nested containers. Static processing may also run at request time on a server.