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

@peisar/peisar-visitors

v0.1.1

Published

<!-- markdownlint-disable MD033 --> <!-- markdownlint-disable MD041 --> <div align="center"> <img src="https://pub-c9ba018358dd48a99b70013b65a25e5f.r2.dev/logo/peisar.webp" width="160" height="160" alt="peisar" /> <h1>Peisar Visitors</h1> <p>AST visit

Readme

Install

npm i @peisar/peisar-visitors

Visitors

1. Syntax Highlighting

Syntax highlighting for Peisar via shiki,highlight.js or prismjs.

API

highlightVisitor(fn: HighlighterFunction, shiki?: boolean, preClass?: string): Visitor
  • fn — highlighter callback (code, lang) => html.
  • shiki — pass true when using shiki, since its output already includes the <pre><code> wrapper; other libraries get wrapped automatically. Default: false.
  • preClass — extra class for the generated <pre> element (non-shiki only).

Every CodeBlock is replaced with the HTML returned by fn. Fences without a language tag are highlighted as plain text.

Use example

With shiki
npm i shiki
import { createHighlighter } from "shiki";
import { Peisar } from "peisar";
import { highlightVisitor } from "@peisar/peisar-visitors";

const code = "const a = 1";

const highlighter = await createHighlighter({
  themes: ["slack-dark"],
  langs: ["js"],
});

function shiki_hl(code: string, lang: any) {
  return highlighter.codeToHtml(code, { lang: lang, theme: "slack-dark" });
}

const peisar = new Peisar(code);
peisar.useVisitor(highlightVisitor(shiki_hl, true));

const html = peisar.html;

console.log(html);
With highlight.js
npm i highlight.js
import hljs from "highlight.js";
import { Peisar } from "peisar";
import { highlightVisitor } from "@peisar/peisar-visitors";

const markdown = "```js\nconst a = 1\n```";

function hljs_hl(code: string, lang: any) {
  return hljs.highlight(code, { language: lang }).value;
}

const peisar = new Peisar(markdown);
peisar.useVisitor(highlightVisitor(hljs_hl));

console.log(peisar.html);
With prismjs
npm i prismjs
import Prism from "prismjs";
import { Peisar } from "peisar";
import { highlightVisitor } from "@peisar/peisar-visitors";

const markdown = "```js\nconst a = 1\n```";

function prism_hl(code: string, lang: any) {
  const grammar = Prism.languages[lang] ?? Prism.languages.javascript;
  return Prism.highlight(code, grammar, lang);
}

const peisar = new Peisar(markdown);
peisar.useVisitor(highlightVisitor(prism_hl));

console.log(peisar.html);

2. GitHub Alerts

GitHub-style alerts for Peisar — turns a block quote whose first line is a marker like [!NOTE] into a colored badge, keeping the rest of the quote as the alert body.

> [!WARNING]
> This action cannot be undone.

Supported markers: [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] and [!CAUTION]. A marker only matches when it is the entire first text node of the quote — [!NOTE] Read this renders as a normal block quote.

API

alertsVisitor(): Visitor

Use example

import { Peisar } from "peisar";
import { alertsVisitor } from "@peisar/peisar-visitors";

const markdown = "> [!NOTE]\n> Useful information.";

const peisar = new Peisar(markdown);
peisar.useVisitor(alertsVisitor());

console.log(peisar.html);