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

docstrip

v1.0.3

Published

Documentation utility: generates markdown and javascript.

Readme

docstrip

Docstrip is a tool for creating packages and their documentation in an elegant, literate programming scheme.

The syntax is sort of similar to the TeX docstrip utility, by which all comments ~~are~~ can be removed. Markdown and Javascript files are generated with shared or respectively designated comments. Every non-commented line or block is implicitly javascript.

Basic Usage and File Structure

Basic usage involves a source file and the docstrip script file. This package, for example, places the docstrip (docstrip.js) and source (index.js) files within the /docstrip subdirectory, and the destination file is aimed at the top level (which happens to also be named docstrip).

Project
 |__ docstrip
 |    |__ docstrip.js
 |    |__ source.js
 |__ output.js
 |__ output.md

Concurrent File Structures

Removable comments not only facilitates the organization of file type-specific content, but it also allows for the possibility of protected (or disappearing) comments. This means a project could be built in a private local directory, then stripped to a more navigable (and publishable) version of the project.

Project
 |__ Private
 |    |__ docstrip.js
 |    |__ source.js
 |__ Public
      |__ output.js
      |__ output.md

Source File

Single Lines

A line beginning with // such as ...

// my comment here

will be rendered in place in both markdown and javascript destinations.

A line beginning with //. will render to javascript only.

//. my javascript comment here

A line beginning with //m such as ...

//m my markdown here

will be rendered to markdown only, and excluded in any javascript destination.

White-space-only lines are always removed. This means your source can make use of white space for legibility, while the output file(s) -- the code ultimately used -- is reduced (though not minimized).

Blocks

Lines between the delimeters ///. and //./ will render to javascript only.

///.

let self = 1;

function me(x) {
  return x * self;
}

//./

Lines between the delimeters ///m and //m/ will render to markdown only.

///m

## foo

Here is some markdown stuff.

//m/

docstrip script

Put the necessary lines from the following all in one file, then nodee <that file>.

var ds = require('docstrip');

It might eventually be useful/necessary to have some sort of package options protocol, and at that point surely the distinction of .javascript/.markdown/etc. functionality will be essential. For now it may be a little tedious, but you can of course wrap these with your own conveninece functions, which is sort of the aim anyway.

render markdown

ds.markdown("../original/index.js", "../new/README.md");

render javascript

ds.javascript("../original/index.js", "../new/index.js");