Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including tocsify with all npm packages installed. Try it out:

var tocsify = require("tocsify")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tocsify v2.0.0

Generates a table of contents based on the structure of your docsify docs directory!

📋 tocsify

NPM version NPM downloads Build Status Dependencies Status DevDependencies Status License: MIT

📋 npm module that generates a table of contents based on the file structure of a Docsify docs directory!

Features

  • Adds relative path to title in each top-level entry for context.
  • Skips markdown files beginning with _.
  • Skips generation for headers marked {docsify-ignore}
  • If {docsify-ignore-all} exists in a top level header (# Example Header {docsify-ignore-all}), skip generating the table of contents for the entire document.

Installation

Install globally for use in any Docsify project!

npm install -g tocsify

Usage

Save to File

From the root of your project, simply run:

tocsify ./docs --file=./docs/toc.md

Save File with Verbose Output

For verbose output that also saves to a file, run:

tocsify ./docs --file=./docs/toc.md --verbose

Write to Console

To just write to stdout -- without saving a file -- run:

tocsify ./docs --verbose

Integration

Integration with a Docsify homepage is easy!

In index.md, paste the snippet below where the Table of Contents should appear:

## Table of Contents
[filename](toc.md ':include')

A working index.md file can be found in the docs directory here for reference.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free