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

grunt-jsdoc2md

v1.3.0

Published

Generate markdown api documentation from jsdoc.

Downloads

205

Readme

npm version License: MIT jsdoc Built with Grunt dependencies Build & Test codecov

BOTTOM AI CHANGELOG LICENSE

grunt-jsdoc2md

Generate structured Markdown API documentation from JSDoc using jsdoc-to-markdown,
with deterministic tree rendering and optional automatic API index generation.


content

Changelog
Details on AI assistance during development


Overview

grunt-jsdoc2md is a Grunt multitask that transforms one or more JSDoc-annotated JavaScript source files into Markdown documentation.

The plugin adds structural capabilities on top of jsdoc-to-markdown:

  • Deterministic depth-first tree rendering
  • Automatic directory structure generation
  • Optional aggregated API index generation
  • Sequential fail-fast execution semantics
  • Integrated dmd-readable defaults

Requirements

  • Node.js >= 20
  • Grunt >= 1.x

Installation

npm install grunt-jsdoc2md --save-dev

Load the plugin in your Gruntfile.js:

grunt.loadNpmTasks("grunt-jsdoc2md");

Run the task:

grunt jsdoc2md

getting started

This guide assumes familiarity with npm and Grunt.

Minimal configuration example:

module.exports = function (grunt) {
  grunt.initConfig({
    jsdoc2md: {
      api: {
        src: "src/**/*.js",
        dest: "docs/api/"
      }
    }
  });

  grunt.loadNpmTasks("grunt-jsdoc2md");
};

Running grunt jsdoc2md generates Markdown documentation in docs/api/.


usage

The plugin supports two execution modes depending on dest.

module.exports = function (grunt) {
  return {
    options: {
      // All jsdoc-to-markdown options are supported.
    },

    directoryExample: {
      src: "src/lib/**/*.js",
      dest: "docs/api/",
      options: {
        index: {
          dest: "docs/api.md"
          // template: "partials/api.hbs"
        }
      }
    },

    fileExample: {
      src: "src/lib/**/*.js",
      dest: "docs/aggregated-api.md"
    }
  };
};

Rendering modes

Directory Mode

If dest:

  • already exists and is a directory, or
  • ends with / or \

each source file is rendered into a corresponding Markdown file.

A directory tree is constructed from the source paths.

Example:

src/lib/index.js
src/lib/utils/helper.js

Produces:

docs/api/index.md
docs/api/utils/helper.md

Rendering is:

  • Depth-first
  • Strictly sequential per node
  • Deterministic in output order

Optional index generation is supported.


File Mode

If dest is a file path, all source files are rendered into a single aggregated Markdown file.

No directory tree is created.


API index generation

If options.index !== false, an aggregated API index file is generated.

options: {
  index: {
    dest: "docs/api.md",
    template: "partials/api.hbs" // optional
  }
}

Behavior:

  • All rendered fileset data is aggregated
  • A template is applied
  • Default template: {{>api}}
  • Rendering is deterministic
  • Fail-fast on error

If options.index === false, no index file is created.


Deterministic rendering semantics

The plugin enforces:

  • Sequential file rendering within each node
  • Depth-first tree traversal
  • Stable aggregation order
  • Fail-fast behavior on errors

This ensures reproducible documentation output across environments.


Error handling

  • Missing src → warning
  • Rendering failure → task failure
  • Index generation failure → task failure

No partial recovery is attempted.


Notes

Handlebars may cache compiled templates during development. If template changes are not reflected, clear your system temp directory.

TOP AI CHANGELOG LICENSE