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-plugin-viewerjs

v2.0.1

Published

Image viewer for VitePress 1 and 2, based on viewerjs

Downloads

340

Readme

vitepress-plugin-viewerjs

Click any image in your VitePress docs to open it in a viewerjs lightbox.

A fork of T-miracle/vitepress-plugin-image-viewer, rewritten for VitePress 2.x alpha. Still works on VitePress 1.x.

Install

npm i vitepress-plugin-viewerjs viewerjs

Usage

.vitepress/theme/index.ts:

import DefaultTheme from 'vitepress/theme'
import type { Theme } from 'vitepress'
import 'viewerjs/dist/viewer.css'
import useImageViewer, { VImageViewer } from 'vitepress-plugin-viewerjs'

export default {
  extends: DefaultTheme,
  enhanceApp({ app }) {
    // Only if you want the <VImageViewer> component in markdown.
    app.component('VImageViewer', VImageViewer)
  },
  setup() {
    useImageViewer()
  }
} satisfies Theme

The viewer.css import has to live in your theme file. The plugin is plain JavaScript so VitePress can load it during the SSR build, which means it cannot import a stylesheet on your behalf.

Options

useImageViewer({
  selector: '.vp-doc',   // container(s) to scan; every match gets its own viewer
  svg: true,             // also open inline <svg> (mermaid diagrams, etc.)
  cursor: 'zoom-in',     // cursor over anything clickable; false to leave the page's own
  viewer: {}             // https://github.com/fengyuanchen/viewerjs#options
})

Returns { refresh, destroy }. Disposed automatically with the surrounding component.

What gets a viewer

| | | | --- | --- | | ![]() and <img> | png, jpeg, gif, webp, avif, svg | | <picture> / srcset | opens the source the browser resolved, not the fallback | | images inside links | opens the viewer instead of following the link | | inline <svg> | mermaid and the like, serialised at 2x so zooming stays sharp | | images added later | lazy content, client-only components, other plugins |

Skipped: display: none images (so light/dark pairs leave no gaps), anything marked data-viewer-ignore or inside .no-viewer, and inline SVG that is an icon rather than a diagram (aria-hidden, under 100x100 in area, or inside a link or button).

Point at a higher-resolution original with data-viewer-src:

<img src="/thumb.png" data-viewer-src="/original.png" alt="a thumbnail">

Component

<VImageViewer src="/demo.png" alt="open the demo image" />

| prop | type | default | | --- | --- | --- | | src | string | required | | alt | string | '', also the button label | | inline | boolean | false | | options | Viewer.Options | none |

openImageViewer(src, alt?, options?) is exported too.

Changes from 1.x

  • The package is published as vitepress-plugin-viewerjs. Upstream keeps the vitepress-plugin-image-viewer name.
  • imageViewer(route) becomes useImageViewer(). The route argument is gone. The plugin watches the DOM instead of the router, so it also picks up images that appear after the page renders. The old three-argument call still works.
  • vitepress-plugin-image-viewer/lib/vImageViewer.vue becomes import { VImageViewer } from 'vitepress-plugin-viewerjs'. The component owns its own viewer now, so it works outside .vp-doc.
  • Default toolbar no longer uses bare numbers. viewerjs reads those as a responsive visibility level, not a button size, so { zoomIn: 4 } and friends hid the entire toolbar below 1200px. If you pass your own, use { show: true, size: 'large' } per button.
  • Viewers are rebuilt per page rather than updated, so a page with no images no longer inherits the previous page's gallery, and they are destroyed on unmount.

Development

pnpm install && pnpm test && pnpm docs:dev

License

MIT