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

gen-md-toc

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gen-md-toc

A CLI to generate a markdown table of contents & insert it in

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Markdown Table of Contents Generator

Quickly generate a table of contents from a markdown file and optionally insert it inline.

Table of Contents

  • Usage
  • Dependancies
  • API

Usage

Installation

# Install on a project as a dev dependancy
npm i -D gen-md-toc

Example use

# Output a table of contents for a README.md in the current directory
npx gen-md-toc

# Insert a table of contents in the local README.md
# -> Replaces inbetween <!-- toc-head --> and <!-- toc-tail -->
npx gen-md-toc -i

# Output a table of contents for a different file
npx gen-md-toc -f CONTRIBUTING.md

Full usage info

Usage: gen-md-toc [options]

A tool for generating a table of contents for readmes

Options:
  -V, --version          output the version number
  -f --file [README.md]  specify where the readme file you want to use is (default: "README.md")
  -i --inline [false]    whether to edit the table of contents inline, it replaces for '<!-- toc-head -->' and <!-- toc-tail --> (default: false)
  -h, --help             output usage information

Dependancies

This module only has 2 dependancies, casex & commander, as of writing neither of which have any nested dependancies.

API

You can use this programmatically in node by importing the module, see cli.js for detailed usage.

const { tableOfContents, headTag, tailTag } = require('gen-md-toc')

// filename: string
// inline: boolean
tableOfContents(filename, inline)

FAQs

Package last updated on 10 Dec 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc