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

@proticom/paperboy-widget

v0.2.2

Published

Embeddable web/markdown toggle widget — converts any page to Markdown with one click.

Readme

Paperboy Widget (Embeddable Script)

Paperboy Widget adds a small web / markdown toggle to any website.

When users switch to Markdown view, the widget:

  • Converts the page content to Markdown
  • Shows it in a code-style panel
  • Lets users copy it with one click

Quick Start

Build the widget first:

npm install
npm run build

Then include dist/paperboy-widget.min.js on your site:

<script src="/path/to/paperboy-widget.min.js"></script>

That is enough for basic usage.


Recommended Usage (Choose Exactly What to Convert)

For best results, tell the widget which part of the page is the main content.

<script src="/path/to/paperboy-widget.min.js" data-selector="#main-content"></script>

data-selector should be any valid CSS selector:

  • #main-content
  • .article-body
  • main

If data-selector is not provided, Paperboy tries this order:

  1. main
  2. article
  3. Elements between header and footer
  4. Most body children as fallback

Options

data-selector

Defines exactly which DOM element to convert.

Example:

<script src="/path/to/paperboy-widget.min.js" data-selector="main"></script>

data-default-view

Optional default view mode:

  • web
  • md

Example:

<script
  src="/path/to/paperboy-widget.min.js"
  data-selector="#main-content"
  data-default-view="md"
></script>

Features

  • Web / Markdown toggle with animated pill indicator
  • One-click copy with 2-second "Copied" feedback
  • Light and dark theme via prefers-color-scheme
  • Minimize / restore — users can collapse the toggle to a small button
  • Keyboard accessible — Escape closes the overlay, focus is trapped while open
  • Mobile friendly — tap targets meet 36px minimum, layout adjusts for small screens
  • View persistence — chosen view and collapsed state saved in localStorage
  • No host page conflicts — CSS variables scoped to widget elements only

Build From Source

Install dependencies:

npm install

Build once:

npm run build

Build in watch mode while developing:

npm run build:watch

Output file:

dist/paperboy-widget.min.js


Tests

Run tests:

npm test

Watch mode:

npm run test:watch

How It Works

  1. Widget injects a small toggle pill in the bottom-right corner.
  2. User picks Web or Markdown.
  3. In Markdown mode, widget converts selected HTML to Markdown using Turndown + GFM plugin.
  4. Widget shows a centered <pre> block with a Copy button.
  5. View choice is remembered in localStorage (paperboy-view).
  6. The toggle can be minimized to a small restore button (also remembered).

Project Structure

paperboy-widget/
  src/
    widget.js          Entry point, UI, DOM, event handling
    turndown-config.js Turndown setup with shared conventions
    styles.js          Scoped CSS for all widget elements
  tests/
    turndown-config.test.js
  dist/
    paperboy-widget.min.js
  build.js             esbuild bundler script
  vitest.config.js     Test configuration
  package.json