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

files2md

v1.0.1

Published

Automagically generate file trees in your markdown files

Downloads

16

Readme

files2md build

Automagically generate table of contents from the files in your repository

Install

$ npm install --global files2md

Usage

Example

You will most likely want to use the CLI.

Given the following readme.md:

This are all the markdown files in this directory:

<!-- START files2md -->
<!-- END files2md -->

Execute:

$ files2md readme.md

And you will obtain:

These are all the markdown files in this directory:

<!-- START files2md -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN files2md TO UPDATE -->

- [fixtures](./fixtures)
	- [1](./fixtures/1)
		- [2](./fixtures/1/2)
			- [fixtures/1/2/c.md](./fixtures/1/2/c.md)
		- [fixtures/1/b.md](./fixtures/1/b.md)
	- [fixtures/a.md](./fixtures/a.md)
- [readme.md](./readme.md)

<!-- END files2md -->

You can see an example at: aymericbeaumet/til.

API

fromFile(filepath: String, options: Object, done: (err: Error, newBuffer: Buffer) => void): void

Modify a file in place with the updated table of contents.

fromBuffer(buffer: Buffer, options: Object, done: (err: Error, newBuffer: Buffer) => void): void

Return a new buffer with the updated table of contents.

CLI

$ files2md --help

  Automagically generate file trees in your markdown files

  Usage
    $ files2md [options] [file]...

  Options
    --cwd             Change the current working directory (default: `process.cwd()`)
    --dot             Whether the dot files should be matched (default: `false`)
    --dry-run         Do not write the results to the disk (default: `false`)
    --extensions      Pipe separated list of extensions to filter, empty string to disable (default: `.md|.markdown`)
    --extract-headers Extract the first header matching the given level as the title, `0` to disable (default: `0`)
    --follow          Whether symlinks should be followed (default: `false`)
    --footer          Append a files2md footer in the generated table of contents (default: `false`)
    --ignore          Pipe separated list of glob patterns to ignore (default: `.git|bower_components|node_modules`)
    --indent          Can be either `space` or `tabs` (default: inferred, fallback to space)
    --linebreak       Can be either `crlf`, `cr` or `lf` (default: inferred, fallback to lf)
    --lint            Abort if the contents is outdated
    --max-depth       The max-depth relatively to the CWD, inclusive (default: `Infinity`)
    --min-depth       The min-depth relatively to the CWD, inclusive (default: `0`)

Changelog

  • 1.0.1

    • Fix issue with relative path
  • 1.0.0

    • Bump stable

License

CC0

To the extent possible under law, Aymeric Beaumet has waived all copyright and related or neighboring rights to this work.