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

vitepress-enrich

v0.4.1

Published

Glossary auto-linking, content linkification, SEO helpers, and tooltip CSS for VitePress sites

Readme

@bearly/vitepress-enrich

Glossary auto-linking, SEO structured data, and tooltip CSS for VitePress documentation sites.

Used by silvery.dev, termless.dev, and terminfo.dev.

Features

  • Glossary auto-linking — markdown-it plugin that auto-links terms on first mention per page, longest-match-first, skipping code/headings/links
  • Content linkification — build-time string linkifier for v-html content in dynamic routes
  • SEO helpers — OpenGraph, canonical URLs, JSON-LD (WebSite, BreadcrumbList, TechArticle, SoftwareSourceCode, FAQPage, HowTo)
  • Build-time validation — warns on broken glossary links during docs:build
  • Tooltip CSS — pure CSS hover tooltips, no JavaScript

Quick Start

bun add -d @bearly/vitepress-enrich

1. Create a glossary

docs/content/glossary.json:

[
  { "term": "SelectList", "href": "/api/select-list", "tooltip": "Interactive list component" },
  { "term": "SGR", "tooltip": "Select Graphic Rendition — controls text styling" },
  { "term": "Termless", "href": "https://termless.dev", "tooltip": "Headless terminal testing", "external": true }
]

2. Wire up VitePress

.vitepress/config.ts:

import { defineConfig } from "vitepress"
import { glossaryPlugin, seoHead, seoTransformPageData, validateGlossary } from "@bearly/vitepress-enrich"
import glossary from "../content/glossary.json"

const seo = {
  hostname: "https://my-site.dev",
  siteName: "My Site",
  description: "What my site does",
  ogImage: "https://my-site.dev/og-image.svg",
  author: "Author Name",
  codeRepository: "https://github.com/me/my-site", // optional — enables SoftwareSourceCode on /api/ pages
}

export default defineConfig({
  lastUpdated: true,

  markdown: {
    config(md) {
      md.use(glossaryPlugin, { entities: glossary })
    },
  },

  head: [...seoHead(seo)],

  transformPageData: seoTransformPageData(seo),

  buildEnd(siteConfig) {
    validateGlossary(glossary, siteConfig)
  },
})

3. Import CSS

.vitepress/theme/index.ts:

import DefaultTheme from "vitepress/theme"
import "@bearly/vitepress-enrich/css/tooltip.css"
import "@bearly/vitepress-enrich/css/glossary-links.css"

export default { extends: DefaultTheme }

That's it. Every page now gets glossary auto-linking, tooltips, and structured data.

Glossary Entity Format

interface GlossaryEntity {
  term: string // Text to match (word-boundary, case-sensitive)
  href?: string // Link URL — omit for tooltip-only
  tooltip?: string // Hover tooltip text
  external?: boolean // Opens in new tab
}

Linking behavior:

  • Longest match wins ("Kitty keyboard protocol" before "Kitty")
  • First occurrence only per page (no link spam)
  • Skips code blocks, inline code, headings, and existing links
  • With href: renders as <a class="hover-link"> (dotted underline, links on hover)
  • Without href: renders as <span class="glossary-hint"> (tooltip only, help cursor)

SEO Schemas

seoTransformPageData() adds to every page:

| Schema | When | What | | ---------------------- | --------------------------------------------- | ------------------------------------------- | | BreadcrumbList | All pages with path segments | Auto-generated from URL path | | TechArticle | All non-home pages | headline, description, dateModified, author | | SoftwareSourceCode | Pages under apiPathPrefix (default /api/) | programmingLanguage, codeRepository | | FAQPage | frontmatter.faq array | Question/Answer pairs | | HowTo | frontmatter.howto object | Numbered steps |

FAQPage (opt-in)

Add to page frontmatter:

---
faq:
  - q: "Do I need a real terminal?"
    a: "No, it runs headless."
  - q: "Which backend should I use?"
    a: "vterm.js for most cases."
---

HowTo (opt-in)

---
howto:
  name: "Get Started with My Tool"
  steps:
    - "Install with bun add my-tool"
    - "Create a config file"
    - "Run the dev server"
---

Build-Time Linkification

For dynamic routes that use v-html, use createLinkifier:

import { createLinkifier } from "@bearly/vitepress-enrich/linkify"
import glossary from "../content/glossary.json"

const linkify = createLinkifier(glossary)
const enrichedHtml = linkify("Use SelectList for keyboard navigation")
// → 'Use <a href="/api/select-list" class="hover-link" data-tooltip="...">SelectList</a> for keyboard navigation'

Validation

validateGlossary() runs at build time and:

  • Reports term counts: [glossary] 53 terms (31 linked, 22 tooltip-only, 3 external)
  • Warns on broken internal links: ⚠ "SelectList" → /api/select-list if the page doesn't exist

Exports

| Export | Path | Purpose | | ---------------------- | ------------------------------------------------- | --------------------------- | | glossaryPlugin | @bearly/vitepress-enrich | markdown-it plugin | | createLinkifier | @bearly/vitepress-enrich/linkify | Build-time string linkifier | | seoHead | @bearly/vitepress-enrich/seo | Static <head> entries | | seoTransformPageData | @bearly/vitepress-enrich/seo | Per-page SEO hook | | validateGlossary | @bearly/vitepress-enrich/validate | Build-time link validation | | compileEntities | @bearly/vitepress-enrich | Low-level entity compiler | | replaceEntities | @bearly/vitepress-enrich | Low-level text replacer | | CSS | @bearly/vitepress-enrich/css/tooltip.css | Hover tooltip styles | | CSS | @bearly/vitepress-enrich/css/glossary-links.css | Link/hint styles |

Requirements

  • VitePress >= 1.0
  • Node.js >= 23.6.0 (native TypeScript) or Bun

License

MIT