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

snipshot

v1.0.3

Published

Generate PNG screenshots of code snippets with syntax highlighting, line numbers, and colored annotations from the CLI

Downloads

32

Readme




Features

  • Syntax highlighting for 200+ languages via Shiki (VS Code-quality tokenization)
  • Line numbers with proper gutter alignment
  • Red/green highlights — full lines or precise column ranges
  • Fold/collapse line ranges to hide boilerplate with --fold
  • Word wrap with --max-width for report-friendly output
  • Automatic language detection from 150+ file extensions, with graceful plaintext fallback for unknown types
  • Dark theme (One Dark Pro)
  • Offline — everything runs locally, no network needed
  • Standalone binaries for Linux, Windows, and macOS (via Bun compile)

Install

# npm (requires Node.js >= 18)
npm install -g snipshot

# or run directly
npx snipshot <file> --lines <range>

Usage

snipshot <file> --lines <start>-<end> [options]

Options

| Option | Description | |---|---| | --lines <range> | Line range to capture, e.g. 42-56 (required) | | --highlight-red <spec> | Highlight in red (repeatable) | | --highlight-green <spec> | Highlight in green (repeatable) | | --fold <range> | Collapse a line range into a single indicator row (repeatable) | | --max-width <pixels> | Max image width — enables word wrap | | --output <path> | Output file path (default: <name>_L<start>-<end>.png) | | --root <path> | Project root for relative path display |

Highlight format

47           # entire line 47
47-50        # lines 47 through 50
47:12-38     # line 47, columns 12 to 38

Examples

# Basic screenshot
snipshot src/App.java --lines 42-56

# With highlights
snipshot src/App.java --lines 42-56 --highlight-red 47 --highlight-green 50

# Column-precise highlight
snipshot src/App.java --lines 42-56 --highlight-red 47:12-38

# Word wrap for reports
snipshot src/App.java --lines 1-20 --max-width 700

# Fold boilerplate to focus on what matters
snipshot src/App.java --lines 1-80 --fold 5-30 --fold 60-70

# Custom output path
snipshot src/App.java --lines 42-56 --output screenshot.png

Examples

TypeScript with interface highlight and column annotation:

Word wrap with mixed highlights (--max-width 700):

Clean output without highlights:

Standalone binaries

Pre-built binaries include the Bun runtime — no Node.js installation needed on the target machine.

Download

Grab the archive for your platform from Releases, extract it, and run:

./snipshot src/App.java --lines 10-30

Build from source

Requires Bun:

# All platforms (linux, win, mac-intel, mac-arm)
npm run build:standalone

# Specific platform
node scripts/build-standalone.mjs linux
node scripts/build-standalone.mjs win
node scripts/build-standalone.mjs mac-arm

# Multiple
node scripts/build-standalone.mjs linux,win

Output goes to standalone/snipshot-<platform>/. Each directory is self-contained.

Install system-wide (Linux/macOS):

sudo cp -r standalone/snipshot-linux-x64 /opt/snipshot
sudo ln -s /opt/snipshot/snipshot /usr/local/bin/snipshot

How it works

  1. Reads the full source file (not just the requested lines) to ensure accurate syntax highlighting
  2. Tokenizes with Shiki using the One Dark Pro theme
  3. Renders to a canvas with @napi-rs/canvas (Skia-based, no browser needed)
  4. Exports as PNG

The font used is JetBrains Mono (bundled).

Development

git clone https://github.com/n8tz/snipshot.git
cd snipshot
npm install

npm run build        # compile TypeScript
npm test             # run tests (29 tests)
npm run test:watch   # watch mode

License

MIT