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

jsonschema-mdbook-prepare

v0.1.2

Published

jsonschema-mdbook-prepare =========================

Downloads

0

Readme

jsonschema-mdbook-prepare

CircleCI Version

Overview

In order to publish JSON Schema documentation to a website, we use jsonschema2md to first generate the schema documentation in Markdown, then mdBook to create the human-readable HTML website.

mdBook takes a file, SUMMARY.md, to tell it what markdown files it needs to include, as well as to create a sidebar menu with the table of contents.

jsonschema2md generates a lot of files, including ones for the top-level schemas but also many smaller files for each object and property. Including all of these in SUMMARY.md generates an extremely cluttered TOC menu, however mdBook will only generate HTML files for the Markdown files listed in SUMMARY.md, so only including the top-level schema documents results in lots of broken links.

The solution is to do two passes, one using a SUMMARY.md containing all the files, and a second pass with a tailored SUMMARY.md containing just the top-level schemas, and structured by folder, to generate the desired TOC menu.

After the first pass, we take a copy of the generated HTML files, since mdBook cleans the target folder before each pass. Then after the second pass we copy the additional files created in the first pass back into the final target folder.

There is an additional problem in that the files generated in the first pass contain the cluttered TOC menu with all the files in it, and the menu content is included in every file (i.e. not contained a single shared file), so we need to go through the additional files to replace their menu with the short, structured one generated in the second pass of jsonschema2md.

jsonschema-mdbook-prepare is a CLI program that has two commands, gen-summary and fix-sidebar.

Usage

$ npm install -g jsonschema-mdbook-prepare
$ jsonschema-mdbook-prepare COMMAND
running command...
$ jsonschema-mdbook-prepare (-v|--version|version)
jsonschema-mdbook-prepare/0.1.2 darwin-x64 node-v14.15.3
$ jsonschema-mdbook-prepare --help [COMMAND]
USAGE
  $ jsonschema-mdbook-prepare COMMAND
...

Commands

jsonschema-mdbook-prepare fix-sidebar

Updates the sidebar menu in html files generated by mdBook by reading it from an index.html file that has the desired menu and replacing the menu in the other files.

USAGE
  $ jsonschema-mdbook-prepare fix-sidebar

OPTIONS
  -d, --destPath=destPath      (required) path-to-destination-folder
  -h, --help                   show CLI help
  -s, --sourcePath=sourcePath  (required) path-to-source-folder
  -v, --version                show CLI version

See code: src/commands/fix-sidebar.ts

jsonschema-mdbook-prepare gen-summary

Generates a concise SUMMARY.md for mdbook for content generated using jsonschema2md. Book index will contain just the top level schemas, grouped by folder.

USAGE
  $ jsonschema-mdbook-prepare gen-summary

OPTIONS
  -a, --allFiles               Generate for all .md files, not just top-level schemas
  -h, --help                   show CLI help
  -m, --mdPath=mdPath          (required) path-to-md-files (generated by jsonschema2md)
  -s, --schemaPath=schemaPath  (required) path-to-schemas
  -v, --version                show CLI version

See code: src/commands/gen-summary.ts

jsonschema-mdbook-prepare help [COMMAND]

display help for jsonschema-mdbook-prepare

USAGE
  $ jsonschema-mdbook-prepare help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help