{"_id":"@effect/markdown-toc","_rev":"2-003daa101c51eda0cf51e6ffe06cee7c","name":"@effect/markdown-toc","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@effect/markdown-toc","version":"0.1.0","keywords":["anchor","API documentation","code documentation","commonmark","content navigation","content organization","developer tools","docs","document structure","document","documentation tool","documentation","glossary","heading","headings","index","javascript","links","markdown parser","markdown tools","Markdown-based","markdown-toc","markdown","markup language","md files","md parser","md-toc","md","node.js","npm","open-source","outline","package.json","plugin","README tool","readme","reference","remarkable","remarkableplugin","render","renderer","structure","table of contents","table-of-contents","table","toc-generator","toc","write"],"author":{"url":"https://github.com/jonschlinkert","name":"Jon Schlinkert"},"license":"MIT","_id":"@effect/markdown-toc@0.1.0","maintainers":[{"name":"effect-bot","email":"ma+effect@matechs.com"},{"name":"michael.arnaldi","email":"ma+npm@matechs.com"},{"name":"schickling","email":"schickling.j@gmail.com"}],"contributors":[{"url":"http://maxogden.com","name":"=^._.^="},{"url":"http://angrykoala.github.io","name":"Andrés"},{"url":"https://github.com/Vortex375","name":"Benjamin Schmitz"},{"url":"raunitschka.de","name":"Christian Raunitschka"},{"url":"http://chendaniely.github.io","name":"Daniel Chen"},{"url":"http://about.me/daniel.mietchen","name":"Daniel Mietchen"},{"url":"https://dvcrn.github.io","name":"David Mohl"},{"url":"https://github.com/Feder1co5oave","name":"Federico Soave"},{"url":"https://github.com/garygreen","name":"Gary Green"},{"url":"http://twitter.com/jonschlinkert","name":"Jon Schlinkert"},{"url":"https://tehshrike.github.io","name":"Josh Duff"},{"url":"http://sticklebackplastic.com","name":"Matt Ellis"},{"url":"https://github.com/Marsup","name":"Nicolas Morel"},{"url":"http://rafaelsteil.com","name":"Rafael Steil"},{"url":"https://github.com/RichardBradley","name":"Richard Bradley"},{"url":"https://sethvincent.com","name":"Seth Vincent"},{"url":"http://qliksite.io","name":"Stefan Walther"},{"url":"https://github.com/twang2218","name":"Tao Wang"},{"url":"https://github.com/lu22do"},{"url":"http://zeke.sikelianos.com","name":"Zeke Sikelianos"}],"homepage":"https://github.com/jonschlinkert/markdown-toc","bugs":{"url":"https://github.com/jonschlinkert/markdown-toc/issues"},"bin":{"markdown-toc":"cli.js"},"dist":{"shasum":"41da7ae8a1738522b8948464b6faa714ace585d1","tarball":"https://registry.npmjs.org/@effect/markdown-toc/-/markdown-toc-0.1.0.tgz","fileCount":7,"integrity":"sha512-IRfvvwqQLabVTIw9hhIj4scOGIYPfa13QuEFv+dBWE6p47R+RR0J8jQvfDINFf0Vn80XXVjNRtZxkZpkKXLx2A==","signatures":[{"sig":"MEYCIQCxaGsBCXQbvXl4tSAa/7VhlprpoQMcuZ+5o1WZ8WWpDgIhAMOJM1OANFe615h1ZcHaFJFhB03vHLaWCbpbW5iXtVmH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30467},"main":"index.js","verb":{"run":true,"toc":true,"lint":{"reflinks":true},"tasks":["readme"],"layout":"default","plugins":["gulp-format-md"],"related":{"list":["gfm-code-blocks","markdown-link","markdown-utils","pretty-remarkable","remarkable"]},"reflinks":["gfm-code-blocks","markdown-link","markdown-utils","pretty-remarkable","remarkable","verb","verb-readme-generator"]},"_from":"file:effect-markdown-toc-0.1.0.tgz","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha","changeset-publish":"changeset publish","changeset-version":"changeset version"},"_npmUser":{"name":"michael.arnaldi","email":"ma+npm@matechs.com"},"_resolved":"/tmp/f38ea60d1ca7f9e353adbaff381f2195/effect-markdown-toc-0.1.0.tgz","_integrity":"sha512-IRfvvwqQLabVTIw9hhIj4scOGIYPfa13QuEFv+dBWE6p47R+RR0J8jQvfDINFf0Vn80XXVjNRtZxkZpkKXLx2A==","repository":{"url":"git+https://github.com/jonschlinkert/markdown-toc.git","type":"git"},"_npmVersion":"10.1.0","description":"Generate a markdown TOC (table of contents) with Remarkable.","directories":{"test":"test"},"_nodeVersion":"20.9.0","dependencies":{"minimist":"^1.2.0","list-item":"^1.1.1","lazy-cache":"^2.0.2","mixin-deep":"^1.1.3","remarkable":"^1.7.1","gray-matter":"^3.1.1","object.pick":"^1.2.0","strip-color":"^0.1.0","concat-stream":"^1.5.2","markdown-link":"^0.1.1","repeat-string":"^1.6.1","diacritics-map":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@8.15.1","devDependencies":{"mocha":"^10.2.0","gulp-format-md":"^2.0.0","@changesets/cli":"^2.27.1","@changesets/changelog-github":"^0.5.0"},"_npmOperationalInternal":{"tmp":"tmp/markdown-toc_0.1.0_1712783866270_0.22090229309270693","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-04-10T21:17:46.179Z","modified":"2026-09-18T21:17:36.918Z","0.1.0":"2024-04-10T21:17:46.468Z"},"bugs":{"url":"https://github.com/jonschlinkert/markdown-toc/issues"},"author":{"url":"https://github.com/jonschlinkert","name":"Jon Schlinkert"},"license":"MIT","homepage":"https://github.com/jonschlinkert/markdown-toc","keywords":["anchor","API documentation","code documentation","commonmark","content navigation","content organization","developer tools","docs","document structure","document","documentation tool","documentation","glossary","heading","headings","index","javascript","links","markdown parser","markdown tools","Markdown-based","markdown-toc","markdown","markup language","md files","md parser","md-toc","md","node.js","npm","open-source","outline","package.json","plugin","README tool","readme","reference","remarkable","remarkableplugin","render","renderer","structure","table of contents","table-of-contents","table","toc-generator","toc","write"],"repository":{"url":"git+https://github.com/jonschlinkert/markdown-toc.git","type":"git"},"description":"Generate a markdown TOC (table of contents) with Remarkable.","contributors":[{"url":"http://maxogden.com","name":"=^._.^="},{"url":"http://angrykoala.github.io","name":"Andrés"},{"url":"https://github.com/Vortex375","name":"Benjamin Schmitz"},{"url":"raunitschka.de","name":"Christian Raunitschka"},{"url":"http://chendaniely.github.io","name":"Daniel Chen"},{"url":"http://about.me/daniel.mietchen","name":"Daniel Mietchen"},{"url":"https://dvcrn.github.io","name":"David Mohl"},{"url":"https://github.com/Feder1co5oave","name":"Federico Soave"},{"url":"https://github.com/garygreen","name":"Gary Green"},{"url":"http://twitter.com/jonschlinkert","name":"Jon Schlinkert"},{"url":"https://tehshrike.github.io","name":"Josh Duff"},{"url":"http://sticklebackplastic.com","name":"Matt Ellis"},{"url":"https://github.com/Marsup","name":"Nicolas Morel"},{"url":"http://rafaelsteil.com","name":"Rafael Steil"},{"url":"https://github.com/RichardBradley","name":"Richard Bradley"},{"url":"https://sethvincent.com","name":"Seth Vincent"},{"url":"http://qliksite.io","name":"Stefan Walther"},{"url":"https://github.com/twang2218","name":"Tao Wang"},{"url":"https://github.com/lu22do"},{"url":"http://zeke.sikelianos.com","name":"Zeke Sikelianos"}],"maintainers":[{"email":"ma+npm@matechs.com","name":"michael.arnaldi"},{"email":"ma+effect@matechs.com","name":"effect-bot"}],"readme":"# markdown-toc [![NPM version](https://img.shields.io/npm/v/markdown-toc.svg?style=flat)](https://www.npmjs.com/package/markdown-toc) [![NPM monthly downloads](https://img.shields.io/npm/dm/markdown-toc.svg?style=flat)](https://npmjs.org/package/markdown-toc) [![NPM total downloads](https://img.shields.io/npm/dt/markdown-toc.svg?style=flat)](https://npmjs.org/package/markdown-toc)\n\n> Generate a markdown TOC (table of contents) with Remarkable.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n- [Highlights](#highlights)\n- [Usage](#usage)\n- [API](#api)\n  * [toc.plugin](#tocplugin)\n  * [toc.json](#tocjson)\n  * [toc.insert](#tocinsert)\n  * [Utility functions](#utility-functions)\n- [Options](#options)\n  * [options.append](#optionsappend)\n  * [options.filter](#optionsfilter)\n  * [options.slugify](#optionsslugify)\n  * [options.bullets](#optionsbullets)\n  * [options.maxdepth](#optionsmaxdepth)\n  * [options.firsth1](#optionsfirsth1)\n  * [options.stripHeadingTags](#optionsstripheadingtags)\n- [About](#about)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save markdown-toc\n```\n\n# Sponsors\n\nThanks to the following companies, organizations, and individuals for supporting the ongoing maintenance and development of markdown-toc! [Become a Sponsor](https://github.com/sponsors/jonschlinkert) to add your logo to this README, or any of [my other projects](https://github.com/jonschlinkert?tab=repositories&q=&type=&language=&sort=stargazers)\n\n## Gold Sponsors\n\n| [<img src=\"https://github.com/jonschlinkert/clone-deep/assets/383994/98036489-2cae-48a2-8d29-7dec58ea05c4\" alt=\"https://jaake.tech/\" width=\"100\"/>](https://jaake.tech/) |\n|:---:|\n| [https://jaake.tech/](https://jaake.tech/) |\n\n<br />\n\n## Quick Start\n\nAssuming you want to add a TOC to README.md:\n\n1. `$ npm install -g markdown-toc`\n2. Edit README.md and insert the following line where you want the TOC inserted:<br />`<!-- toc -->`\n3. `$ markdown-toc -i README.md`\n\n## CLI\n\n```\nUsage: markdown-toc [options] <input>\n\n  input:        The Markdown file to parse for table of contents,\n                or \"-\" to read from stdin.\n\n  -i:           Edit the <input> file directly, injecting the TOC at - [Highlights](#highlights)\n- [Usage](#usage)\n- [API](#api)\n  * [toc.plugin](#tocplugin)\n  * [toc.json](#tocjson)\n  * [toc.insert](#tocinsert)\n  * [Utility functions](#utility-functions)\n- [Options](#options)\n  * [options.append](#optionsappend)\n  * [options.filter](#optionsfilter)\n  * [options.slugify](#optionsslugify)\n  * [options.bullets](#optionsbullets)\n  * [options.maxdepth](#optionsmaxdepth)\n  * [options.firsth1](#optionsfirsth1)\n  * [options.stripHeadingTags](#optionsstripheadingtags)\n- [About](#about)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_;\n                (Without this flag, the default is to print the TOC to stdout.)\n\n  --json:       Print the TOC in JSON format\n\n  --append:     Append a string to the end of the TOC\n\n  --bullets:    Bullets to use for items in the generated TOC\n                (Supports multiple bullets: --bullets \"*\" --bullets \"-\" --bullets \"+\")\n                (Default is \"*\".)\n\n  --maxdepth:   Use headings whose depth is at most maxdepth\n                (Default is 6.)\n\n  --no-firsth1: Include the first h1-level heading in a file\n\n  --no-stripHeadingTags: Do not strip extraneous HTML tags from heading\n                         text before slugifying\n\n  --indent:     Provide the indentation to use - defaults to '  '\n                (to specify a tab, use the bash-escaped $'\\t')\n```\n\n## Highlights\n\n**Features**\n\n* Can optionally be used as a [remarkable](https://github.com/jonschlinkert/remarkable) plugin\n* Returns an object with the rendered TOC (on `content`), as well as a `json` property with the raw TOC object, so you can generate your own TOC using templates or however you want\n* Works with [repeated headings](https://gist.github.com/jonschlinkert/ac5d8122bfaaa394f896)\n* Uses sane defaults, so no customization is necessary, but you can if you need to.\n* [filter](#filter-headings) out headings you don't want\n* [Improve](#titleize) the headings you do want\n* Use a custom [slugify](#optionsslugify) function to change how links are created\n\n**Safe!**\n\n* Won't mangle markdown in code examples in gfm code blocks that other TOC generators mistake as being actual headings (this happens when markdown headings are show in _examples_, meaning they arent' actually headings that should be in the toc. Also happens with yaml and coffee-script comments, or any comments that use `#`)\n* Won't mangle front-matter, or mistake front-matter properties for headings like other TOC generators\n\n## Usage\n\n```js\nvar toc = require('markdown-toc');\n\ntoc('# One\\n\\n# Two').content;\n// Results in:\n// - [One](#one)\n// - [Two](#two)\n```\n\nTo allow customization of the output, an object is returned with the following properties:\n\n* `content` **{String}**: The generated table of contents. Unless you want to customize rendering, this is all you need.\n* `highest` **{Number}**: The highest level heading found. This is used to adjust indentation.\n* `tokens` **{Array}**: Headings tokens that can be used for custom rendering\n\n## API\n\n### toc.plugin\n\nUse as a [remarkable](https://github.com/jonschlinkert/remarkable) plugin.\n\n```js\nvar Remarkable = require('remarkable');\nvar toc = require('markdown-toc');\n\nfunction render(str, options) {\n  return new Remarkable()\n    .use(toc.plugin(options)) // <= register the plugin\n    .render(str);\n}\n```\n\n**Usage example**\n\n```js\nvar results = render('# AAA\\n# BBB\\n# CCC\\nfoo\\nbar\\nbaz');\n```\n\nResults in:\n\n```\n- [AAA](#aaa)\n- [BBB](#bbb)\n- [CCC](#ccc)\n```\n\n### toc.json\n\nObject for creating a custom TOC.\n\n```js\ntoc('# AAA\\n## BBB\\n### CCC\\nfoo').json;\n\n// results in\n[ { content: 'AAA', slug: 'aaa', lvl: 1 },\n  { content: 'BBB', slug: 'bbb', lvl: 2 },\n  { content: 'CCC', slug: 'ccc', lvl: 3 } ]\n```\n\n### toc.insert\n\nInsert a table of contents immediately after an _opening_ `<!-- toc -->` code comment, or replace an existing TOC if both an _opening_ comment and a _closing_ comment (`<!-- tocstop -->`) are found.\n\n_(This strategy works well since code comments in markdown are hidden when viewed as HTML, like when viewing a README on GitHub README for example)._\n\n**Example**\n\n```\n<!-- toc -->\n- old toc 1\n- old toc 2\n- old toc 3\n<!-- tocstop -->\n\n## abc\nThis is a b c.\n\n## xyz\nThis is x y z.\n```\n\nWould result in something like:\n\n```\n<!-- toc -->\n- [abc](#abc)\n- [xyz](#xyz)\n<!-- tocstop -->\n\n## abc\nThis is a b c.\n\n## xyz\nThis is x y z.\n```\n\n### Utility functions\n\nAs a convenience to folks who wants to create a custom TOC, markdown-toc's internal utility methods are exposed:\n\n```js\nvar toc = require('markdown-toc');\n```\n\n* `toc.bullets()`: render a bullet list from an array of tokens\n* `toc.linkify()`: linking a heading `content` string\n* `toc.slugify()`: slugify a heading `content` string\n* `toc.strip()`: strip words or characters from a heading `content` string\n\n**Example**\n\n```js\nvar result = toc('# AAA\\n## BBB\\n### CCC\\nfoo');\nvar str = '';\n\nresult.json.forEach(function(heading) {\n  str += toc.linkify(heading.content);\n});\n```\n\n## Options\n\n### options.append\n\nAppend a string to the end of the TOC.\n\n```js\ntoc(str, {append: '\\n_(TOC generated by Verb)_'});\n```\n\n### options.filter\n\nType: `Function`\n\nDefault: `undefined`\n\nParams:\n\n* `str` **{String}** the actual heading string\n* `ele` **{Objecct}** object of heading tokens\n* `arr` **{Array}** all of the headings objects\n\n**Example**\n\nFrom time to time, we might get junk like this in our TOC.\n\n```\n[.aaa([foo], ...) another bad heading](#-aaa--foo--------another-bad-heading)\n```\n\nUnless you like that kind of thing, you might want to filter these bad headings out.\n\n```js\nfunction removeJunk(str, ele, arr) {\n  return str.indexOf('...') === -1;\n}\n\nvar result = toc(str, {filter: removeJunk});\n//=> beautiful TOC\n```\n\n### options.slugify\n\nType: `Function`\n\nDefault: Basic non-word character replacement.\n\n**Example**\n\n```js\nvar str = toc('# Some Article', {slugify: require('uslug')});\n```\n\n### options.bullets\n\nType: `String|Array`\n\nDefault: `*`\n\nThe bullet to use for each item in the generated TOC. If passed as an array (`['*', '-', '+']`), the bullet point strings will be used based on the header depth.\n\n### options.maxdepth\n\nType: `Number`\n\nDefault: `6`\n\nUse headings whose depth is at most maxdepth.\n\n### options.firsth1\n\nType: `Boolean`\n\nDefault: `true`\n\nExclude the first h1-level heading in a file. For example, this prevents the first heading in a README from showing up in the TOC.\n\n### options.stripHeadingTags\n\nType: `Boolean`\n\nDefault: `true`\n\nStrip extraneous HTML tags from heading text before slugifying. This is similar to GitHub markdown behavior.\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [gfm-code-blocks](https://www.npmjs.com/package/gfm-code-blocks): Extract gfm (GitHub Flavored Markdown) fenced code blocks from a string. | [homepage](https://github.com/jonschlinkert/gfm-code-blocks \"Extract gfm (GitHub Flavored Markdown) fenced code blocks from a string.\")\n* [markdown-link](https://www.npmjs.com/package/markdown-link): Micro util for generating a single markdown link. | [homepage](https://github.com/jonschlinkert/markdown-link \"Micro util for generating a single markdown link.\")\n* [markdown-utils](https://www.npmjs.com/package/markdown-utils): Tiny helpers for creating consistenly-formatted markdown snippets. | [homepage](https://github.com/jonschlinkert/markdown-utils \"Tiny helpers for creating consistenly-formatted markdown snippets.\")\n* [pretty-remarkable](https://www.npmjs.com/package/pretty-remarkable): Plugin for prettifying markdown with Remarkable using custom renderer rules. | [homepage](https://github.com/jonschlinkert/pretty-remarkable \"Plugin for prettifying markdown with Remarkable using custom renderer rules.\")\n* [remarkable](https://www.npmjs.com/package/remarkable): Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in… [more](https://github.com/jonschlinkert/remarkable) | [homepage](https://github.com/jonschlinkert/remarkable \"Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in one.\")\n\n### Contributors\n\n| **Commits** | **Contributor** |\n| --- | --- |\n| 199 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 9   | [doowb](https://github.com/doowb) |\n| 4   | [dbooth-boston](https://github.com/dbooth-boston) |\n| 3   | [sapegin](https://github.com/sapegin) |\n| 3   | [Marsup](https://github.com/Marsup) |\n| 2   | [dvcrn](https://github.com/dvcrn) |\n| 2   | [maxogden](https://github.com/maxogden) |\n| 2   | [twang2218](https://github.com/twang2218) |\n| 2   | [zeke](https://github.com/zeke) |\n| 1   | [Vortex375](https://github.com/Vortex375) |\n| 1   | [chendaniely](https://github.com/chendaniely) |\n| 1   | [Daniel-Mietchen](https://github.com/Daniel-Mietchen) |\n| 1   | [Feder1co5oave](https://github.com/Feder1co5oave) |\n| 1   | [garygreen](https://github.com/garygreen) |\n| 1   | [TehShrike](https://github.com/TehShrike) |\n| 1   | [citizenmatt](https://github.com/citizenmatt) |\n| 1   | [mgroenhoff](https://github.com/mgroenhoff) |\n| 1   | [rafaelsteil](https://github.com/rafaelsteil) |\n| 1   | [RichardBradley](https://github.com/RichardBradley) |\n| 1   | [sethvincent](https://github.com/sethvincent) |\n| 1   | [shanehughes3](https://github.com/shanehughes3) |\n| 1   | [bcho](https://github.com/bcho) |\n| 1   | [lu22do](https://github.com/lu22do) |\n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2023, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 12, 2023._","readmeFilename":"README.md"}