1.0.5 • Published 5 years ago
hohhoijaa v1.0.5
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,
--checkto 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 hohhoijaaUsage
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.mdBash wildcards work:
hohhoijaa *.mdValidate existing TOCs (if any file needs updating, will exit with 1; otherwise with 0):
hohhoijaa --check *.mdBy default the first H1-level heading is omitted. Can choose to keep it:
hohhoijaa --keep-h1 *.mdTests
Test files are named src/*.test.js.
yarn testLicense
MIT