hohhoijaa

1.0.5 • Public • Published

hohhoijaa

Generate Table of Contents in your Markdown-files

Table of Contents

Why

Yes, there are tons of scripts like this already.

This script is for those of us who want the following:

  • Support multiple files out-of-the-box, i.e. hohhoijaa *.md
  • For CI use, --check to validate existing TOCs but not write anything
  • No external dependencies, just simple text matching (see src/*.test.js, it works just fine)

Installation

npm install --save-dev hohhoijaa

Usage

Add template tag

Add <!-- hohhoijaa --><!-- /hohhoijaa --> to each markdown file where you want the generated Table of Contents to be inserted.

Files without this template tag will be unaffected.

CLI

Basic usage:

hohhoijaa README.md

Bash wildcards work:

hohhoijaa *.md

Validate existing TOCs (if any file needs updating, will exit with 1; otherwise with 0):

hohhoijaa --check *.md

By default the first H1-level heading is omitted. Can choose to keep it:

hohhoijaa --keep-h1 *.md

Tests

Test files are named src/*.test.js.

yarn test

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i hohhoijaa

Weekly Downloads

4

Version

1.0.5

License

MIT

Unpacked Size

12.6 kB

Total Files

11

Last publish

Collaborators

  • codeclown