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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@scalvert/readme-api-generator

v0.2.4

Published

Generates API documentation in your README

Readme

@scalvert/readme-api-generator

Generates API documentation for your README, converting JSDoc to Markdown.

Installation

With npm:

npm install @scalvert/readme-api-generator --save-dev

With yarn:

yarn add @scalvert/readme-api-generator --dev

Usage

The readme-api-generator CLI uses jsdoc-to-markdown combined with HTML comment tokens in your README.md file to generate your API documentation. Follow these steps to set it up.

  1. Add tokens to your README.md

    Add <!--DOCS_START--> and <!--DOCS_END--> HTML comments where you'd like your content to be generated.

    Some text before the docs.
    
    <!--DOCS_START-->
    <!--DOCS_END-->
    
    Some text after the docs.

    :warning: All content in between these tags will be replaced!

  2. Add a script to your package.json that points to the files you want to include in your API documentation.

    Using files:

    "scripts": {
     "docs:generate": "readme-api-generator foo.js bar.js"
    },

    Using a directory:

    "scripts": {
     "docs:generate": "readme-api-generator lib"
    },

    For projects using TypeScript, you can either ensure your TS files are built before generating the docuemntation. The file/directory input should be from your outDir.

    "scripts": {
     "docs:generate": "npm run build && readme-api-generator <files list or directory>"
    },

    Or you can generate the markdown from the TypeScript files directly.

    Then add the following to your package.json, where src is the path your TypeScript files are in:

    "scripts": {
     "docs:generate": "readme-api-generator ./src --ts"
    },
  3. Write your jsdocs!

API

Functions

getFiles(filesOrDirectory) ⇒

Gets a list of files to be used to generate the Markdown content.

Kind: global function Returns: A list of files to be used to generate the markdown.

| Param | Type | Description | | --- | --- | --- | | filesOrDirectory | Array.<string> | The list of files or directory to read. |

getReadme(workingDir) ⇒

Gets and reads the contents of the README.md file.

Kind: global function Returns: A tuple containing the readme file path and content.

| Param | Type | Description | | --- | --- | --- | | workingDir | string | The current working directory. |

generateMarkdown(files) ⇒

Generates the markdown content from the supplied files.

Kind: global function Returns: The rendered markdown.

| Param | Type | Description | | --- | --- | --- | | files | Array.<string> | The list of files to generate the markdown content. |

writeDocs(readmePath, readmeContent, docsContent)

Writes the markdown content into the README.md using the supplied placeholders as a marker to position the content.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | readmePath | string | The path to the README.md file. | | readmeContent | string | The content read from the README.md file. | | docsContent | string | The generated markdown to be written to the README.md file. |

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT