šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

toc-generator-markdown

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons

toc-generator-markdown

A Node.js tool to generate and insert a TOC in a Markdown file.

1.0.0
unpublished
npm
Version published
Weekly downloads
6
20%
Maintainers
0
Weekly downloads
Ā 
Created
Source

Markdown TOC Generator

A simple Node.js tool to generate and insert a Table of Contents (TOC) into a Markdown file.

Features

  • Automatically insert TOC into the source file
  • Add anchor links for headers
  • Generate an indented TOC structure

Installation

npm install

Usage

node index.js <markdown-file>

Example:

node index.js example.md

Testing

npm test

Example Output

Before:

# Title 1
## Subtitle 1.1
### Subtitle 1.1.1
## Subtitle 1.2
# Title 2

After:

<!-- TOC START -->
- [Title 1](#title-1)
  - [Subtitle 1.1](#subtitle-11)
    - [Subtitle 1.1.1](#subtitle-111)
  - [Subtitle 1.2](#subtitle-12)
- [Title 2](#title-2)
<!-- TOC END -->

# Title 1
## Subtitle 1.1
### Subtitle 1.1.1
## Subtitle 1.2
# Title 2

Keywords

markdown

FAQs

Package last updated on 14 Mar 2025

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