Skip to content

codeclown/hohhoijaa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published