New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hohhoijaa

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hohhoijaa

> Generate Table of Contents in your Markdown-files

1.0.5
latest
npm
Version published
Maintainers
1
Created
Source

hohhoijaa

Generate Table of Contents in your Markdown-files

Table of Contents

  • Table of Contents
  • Why
  • Installation
  • Usage
  • Tests
  • License

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

FAQs

Package last updated on 10 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts