md.use(require("markdown-it-table-of-contents"), options);These options are available:NameDescriptionDefault includeLevel Headings levels to use (2 for h2:s etc) [1, 2] containerClass The class for the container DIV "table-of-contents" slugify A custom slugification function encodeURI...
var MarkdownIt = require("markdown-it"); var md = new MarkdownIt(); md.use(require("markdown-it-anchor").default); // Optional, but makes sense as you really want to link to something, see info about recommended plugins below md.use(require("markdown-it-table-of-contents"));...
var MarkdownIt = require("markdown-it"); var md = new MarkdownIt(); md.use(require("markdown-it-anchor").default); // Optional, but makes sense as you really want to link to something, see info about recommended plugins below md.use(require("markdown-it-table-of-contents")); `...
Take for example the three most popular, at the time of writing this README, solutions for this problem:markdown-it-toc-and-anchor,markdown-it-table-of-contents,markdown-it-toc. They all implement their TOC asinlineand, most obscure of all, after theemphasisrule. Does it make any sense...
@leisn/markdown-it-toc Markdown-it plugin to make table of contents, default parse tag [toc]. Installaton $ npm install @leisn/markdown-it-toc or $ yarn add @leisn/markdown-it-toc E.g. default Source markdown [toc]#H1-1##H2-1###H3-1#H1-2 ...
$ npm install --save markdown-toc CLI Usage: markdown-toc [options] <input> input: The Markdown file to parse for table of contents, or "-" to read from stdin. -i: Edit the <input> file directly, injecting the TOC at <!-- toc -->; (Without this flag, the default is to pr...
node_modules/.bin/eslint + - id: eslint + entry: node_modules/.bin/eslint diff --git a/README.md b/README.md index 4dd0fd7d10617..734f13efd5916 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,39 @@ Documentation is written in Markdown (via Remark) and MDX. [...
Furthermore, markdown-it-table-of-contents can handle unusual heading orders. Consider the full example below:var md = new MarkdownIt(); md.use(markdownItTOC, { "includeLevel": [2,3,4] }); md.use(require("markdown-it-attrs")); md.use(require("markdown-it-anchor"));...
vartoc=require('markdown-toc');toc('# One\n\n# Two').content;// Results in:// - [One](#one)// - [Two](#two) To allow customization of the output, an object is returned with the following properties: content{String}: The generated table of contents. Unless you want to customize...