🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

markdown-toc

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-toc

Generate a markdown TOC (table of contents) with Remarkable.

1.2.0
latest
Source
npm
Version published
Weekly downloads
217K
1.27%
Maintainers
2
Weekly downloads
 
Created

What is markdown-toc?

The markdown-toc package is a tool for generating a table of contents (TOC) for markdown files. It can automatically create a TOC based on the headings in a markdown document, making it easier to navigate and organize content.

What are markdown-toc's main functionalities?

Generate TOC from Markdown

This feature allows you to generate a table of contents from a markdown string. The code sample demonstrates how to use the markdown-toc package to create a TOC from a markdown string containing headings.

const toc = require('markdown-toc');
const markdown = '# Title\n## Subtitle\n### Sub-subtitle';
const result = toc(markdown).content;
console.log(result);

Insert TOC into Markdown

This feature allows you to insert a generated TOC directly into a markdown document. The code sample shows how to use the insert method to add a TOC to the markdown content.

const toc = require('markdown-toc');
const markdown = '# Title\n## Subtitle\n### Sub-subtitle';
const result = toc.insert(markdown);
console.log(result);

Customizing TOC

This feature provides options to customize the TOC, such as setting the maximum depth of headings to include. The code sample demonstrates how to generate a TOC with a maximum depth of 2.

const toc = require('markdown-toc');
const markdown = '# Title\n## Subtitle\n### Sub-subtitle';
const result = toc(markdown, { maxdepth: 2 }).content;
console.log(result);

Other packages similar to markdown-toc

Keywords

anchor

FAQs

Package last updated on 19 Sep 2017

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