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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mdextract

v1.0.0

Published

Extracts `/** code comments */` from code files and turns them into markdown docs. Supports JavaScript-style comments (other languages to come).

Downloads

6,179

Readme

mdextract

Extracts /** code comments */ from code files and turns them into markdown docs. Supports JavaScript-style comments (other languages to come).

$ npm install -g mdextract
$ mdextract --help

Use it to extract comments into a doc:

$ mdextract file.js > docs.md

Or update a doc:

$ cat README.md

  add `include` comments to your markdown file

  <!-- include: file.js -->
  <!-- /include: file.js -->

$ mdextract --update README.md

...the --update mode is great for making Readme-based documentation in small projects. It is idempotent.

File format

Sections: mark them with comments beginning with two stars.

/**
 * Sections:
 * Start your sections with two stars.
 *
 * If your first line of text ends in a colon (:), it will be turned into an
 * `<h3>` heading.
 */

Main sections: three stars.

/***
 * Main sections:
 * If you start sections with three stars, the headings will be turned into
 * `<h2>` headings.
 */

Code blocks: They will be converted into syntax-highlighted code fences.

/**
 * An example:
 *
 *     function () {
 *       return true;
 *     }
 */

Definition lists: Use ~ as a bullet. Great for parameter lists.

/**
 * ~ name: description
 * ~ id: the identifier
 * ~ callback (Function): the callback to run afterwards
 */

Sample usage: Use name : usage as your first line to specify a sample usage.

/**
 * push : push(name, fn)
 * Adds an item to the stack.
 */

Single-line mode: for short documentations.

/** id: the identifier. */
this.id = null;

/** name: the name. */
this.name = "Hello";

Examples

Thanks

mdextract © 2014+, Rico Sta. Cruz. Released under the MIT License. Authored and maintained by Rico Sta. Cruz with help from contributors.

ricostacruz.com  ·  GitHub @rstacruz  ·  Twitter @rstacruz