{"name":"markdown-it-toc-and-anchor","version":"4.2.0","description":"markdown-it plugin to add toc and anchor links in headings","keywords":["markdown-it","markdown-it-plugin","markdown","toc","anchor"],"author":{"name":"Maxime Thirouin"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/medfreeman/markdown-it-toc-and-anchor.git"},"main":"dist/index.js","dependencies":{"clone":"^2.1.0","uslug":"^1.0.4"},"devDependencies":{"@babel/cli":"^7.2.3","@babel/plugin-proposal-object-rest-spread":"^7.2.0","@babel/preset-env":"^7.2.3","@babel/register":"^7.0.0","ava":"^1.0.1","coveralls":"^3.0.2","eslint":"^5.11.0","eslint-config-i-am-meticulous":"^11.0.0","eslint-plugin-import":"^2.2.0","markdown-it":"^8.2.2","nyc":"^13.1.0","standard-version":"^4.4.0"},"scripts":{"lint":"eslint --ignore-path .gitignore --fix .","tests":"ava","pretest":"npm -s run lint","test":"npm -s run tests","test-with-coverage":"nyc npm run test","coverage":"nyc report --reporter=text-lcov | coveralls","build":"babel src --ignore \"src/__tests__/**/*.js\" --out-dir dist --delete-dir-on-start","release":"standard-version; git push --follow-tags","prepare":"yarn build"},"babel":{"presets":["@babel/preset-env"],"plugins":["@babel/plugin-proposal-object-rest-spread"]},"eslintConfig":{"extends":["eslint-config-i-am-meticulous"]},"ava":{"files":["**/__tests__/*.js"],"require":["@babel/register"]},"nyc":{"exclude":["**/__tests__/**"],"include":["src/**"]},"gitHead":"c9be94458982899a59601d1a4bbccf2b8be0cc1d","bugs":{"url":"https://github.com/medfreeman/markdown-it-toc-and-anchor/issues"},"homepage":"https://github.com/medfreeman/markdown-it-toc-and-anchor#readme","_id":"markdown-it-toc-and-anchor@4.2.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"med_freeman","email":"mlahlou@protonmail.ch"},"dist":{"integrity":"sha512-DusSbKtg8CwZ92ztN7bOojDpP4h0+w7BVOPuA3PHDIaabMsERYpwsazLYSP/UlKedoQjOz21mwlai36TQ04EpA==","shasum":"d1613327cc63c61f82cd66cbac5564f4db12c0e9","tarball":"http://registry-npm.ywwl.com/markdown-it-toc-and-anchor/download/markdown-it-toc-and-anchor-4.2.0.tgz","fileCount":6,"unpackedSize":31706,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcK+S+CRA9TVsSAnZWagAABC8QAKNAhGlhJPNZ+vP21obG\nqNReuSiE9C/0A/CJMD/EbZQL4XNJaAmbkhBXlidOeCiM9XnUa11SdKGbpGgh\nLypySPVtVMam/x5O7hqHZGVBSY8WzhdXuoMfHfg4n4yUlFlkFVctxIQanO9V\nMnjDAZnNOnYHdqQqr/Nm4b+fwofV/pWAdmj4z6g3+ODzvVGjlJILeEOFaZam\nAKFbgCrnvgr24ZI6JPCJuwQdIhcAAzkCIzgG3yPwEgrEAiq/jF+9cuB4qUZ3\ncHsP7y8IXiCq/hkMKfrwU8rtcS62HjKywpyUgGL+XwpO0WIbBciiXiLWNSEE\nNPNw+/Ob5dv9bAjO2FpxQcq2mSsHcMD/E1wuEq46tpA4uflrT8xxH8g6GgpD\nE530VCuIK4gNR1dfT94pBEamkSWgtl1PSF43hP56ggRi7Phxd0oleThzCXe5\njsT8H1h6HUrvex5Ars6tREyh42MQraU9c1XKoXgmqNRtAJpw2bv2bvSvtNYj\n7BAWqkl3QgRTcJ8Uk5bL/enVgHxeTKFJAeZ3lwSw9ADJFXZ/hfLEaE3p+Bcr\ni7GmBGO9e//bGnmowj5VYL1FcYmYkTBhQdJuWwRrxMbZkuLHPYraphC1wr1R\n/2R4TomJVlKLKECRQpXEOy3Md7SECwF7Dqga5lszjW5U7bIRBqO+WYsDaOzN\nhw3M\r\n=g3S+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCP//R8FvZu8GPObzh7YLonhNLcYIGwwxXLbWrResi92gIhAIyjdqU7JChWpV4UZmd4VJL9ak0T4h0ODHwyuVOlbgAF"}],"size":8512,"noattachment":false,"key":"/markdown-it-toc-and-anchor/-/markdown-it-toc-and-anchor-4.2.0.tgz"},"maintainers":[{"name":"med_freeman","email":"mehdi.lahlou@free.fr"},{"name":"moox","email":"m@moox.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/markdown-it-toc-and-anchor_4.2.0_1546380477519_0.6677843054577206"},"_hasShrinkwrap":false,"readme":"# markdown-it-toc-and-anchor\n[![circleci](https://badgen.net/circleci/github/medfreeman/markdown-it-toc-and-anchor/master)](https://circleci.com/gh/medfreeman/markdown-it-toc-and-anchor)\n[![AppVeyor Build Status](https://img.shields.io/appveyor/ci/medfreeman/markdown-it-toc-and-anchor.svg?label=windows%20build)](https://ci.appveyor.com/project/medfreeman/markdown-it-toc-and-anchor)\n[![Version](https://img.shields.io/npm/v/markdown-it-toc-and-anchor.svg)](https://github.com/medfreeman/markdown-it-toc-and-anchor/blob/master/CHANGELOG.md)\n[![Coverage Status](https://img.shields.io/coveralls/medfreeman/markdown-it-toc-and-anchor/master.svg)](https://coveralls.io/github/medfreeman/markdown-it-toc-and-anchor?branch=master)\n[![Dependency Status](https://img.shields.io/david/medfreeman/markdown-it-toc-and-anchor.svg)](https://david-dm.org/medfreeman/markdown-it-toc-and-anchor)\n\n> markdown-it plugin to add toc and anchor links in headings\n\n## Installation\n\n```console\n$ yarn add markdown-it-toc-and-anchor\n```\n\n## Usage\n\n### ES6\n\n```js\nimport markdownIt from \"markdown-it\"\nimport markdownItTocAndAnchor from \"markdown-it-toc-and-anchor\"\n\nmarkdownIt({\n    html: true,\n    linkify: true,\n    typographer: true,\n  })\n    .use(markdownItTocAndAnchor, {\n      // ...options\n    })\n    .render(md)\n```\n\n### ES5 / CommonJS\n\n```js\nvar markdownIt = require('markdown-it'),\n    markdownItTocAndAnchor = require('markdown-it-toc-and-anchor').default;\n\nmarkdownIt({\n    html: true,\n    linkify: true,\n    typographer: true,\n  })\n    .use(markdownItTocAndAnchor, {\n      // ...options\n    })\n    .render(md)\n```\n\n:information_source: Note that the 'default' property has to be used when requiring this plugin, this is due to the use of Babel 6 now making ES6 compliant exports ([Misunderstanding ES6 Modules, Upgrading Babel, Tears, and a Solution\n](https://medium.com/@kentcdodds/misunderstanding-es6-modules-upgrading-babel-tears-and-a-solution-ad2d5ab93ce0#.enq6dfcnn))\n\n### Options\n\n#### `toc`\n\n(default: `true`)\n\nAllows you to enable/disable the toc transformation of `@[toc]`\n\n#### `tocClassName`\n\n(default: `\"markdownIt-TOC\"`)\n\nOption to customize html class of the `<ul>` wrapping the toc. If no class is wanted set to `null`.\n\n#### `tocFirstLevel`\n\n(default: `1`)\n\nAllows you to skip some heading level. Example: use 2 if you want to skip `<h1>`\nfrom the TOC.\n\n#### `tocLastLevel`\n\n(default: `6`)\n\nAllows you to skip some heading level. Example: use 5 if you want to skip `<h6>`\nfrom the TOC.\n\n#### `tocCallback`\n\n(default: `null`)\n\nAllows you to get toc contents externally by executing a callback function returning toc elements, in addition / instead of using @[toc] tag in content.\nExample :\n\n```\n  markdownIt({\n    html: true,\n    linkify: true,\n    typographer: true,\n  })\n    .use(markdownItTocAndAnchor, {\n      tocCallback: function(tocMarkdown, tocArray, tocHtml) {\n        console.log(tocHtml)\n      }\n    })\n    .render(md)\n```\n\nTo allow callback to be more flexible, this option is also available in global markdown-it options, and in render environment.\nExample :\n\n##### Callback in global markdown-it options\n\n```\n  var mdIt = markdownIt({\n    html: true,\n    linkify: true,\n    typographer: true,\n  })\n    .use(markdownItTocAndAnchor)\n\n  ....\n\n  mdIt.set({\n    tocCallback: function(tocMarkdown, tocArray, tocHtml) {\n      console.log(tocHtml)\n    }\n  })\n    .render(md)\n```\n\n##### Callback in render environment\n\n```\n  var mdIt = markdownIt({\n    html: true,\n    linkify: true,\n    typographer: true,\n  })\n    .use(markdownItTocAndAnchor)\n\n  ....\n\n  mdIt\n    .render(md, {\n      tocCallback: function(tocMarkdown, tocArray, tocHtml) {\n        console.log(tocHtml)\n      }\n    })\n```\n\n#### `anchorLink`\n\n(default: `true`)\n\nAllows you to enable/disable the anchor link in the headings\n\n#### `anchorLinkSymbol`\n\n(default: `\"#\"`)\n\nAllows you to customize the anchor link symbol\n\n#### `anchorLinkSpace`\n\n(default: `true`)\n\nAllows you to enable/disable inserting a space between the anchor link and heading.\n\n#### `anchorLinkSymbolClassName`\n\n(default: `null`)\n\nAllows you to customize the anchor link symbol class name. If not null, symbol will be rendered as `<span class=\"anchorLinkSymbolClassName\">anchorLinkSymbol</span>`.\n\n#### `anchorLinkBefore`\n\n(default: `true`)\n\nAllows you to prepend/append the anchor link in the headings\n\n#### `anchorLinkPrefix`\n\n(default: `undefined`)\n\nAllows you to add a prefix to the generated header ids, e.g. `section-`.\n\n#### `anchorClassName`\n\n(default: `\"markdownIt-Anchor\"`)\n\nAllows you to customize the anchor link class. If no class is wanted set to `null`.\n\n#### `wrapHeadingTextInAnchor`\n\n(default: `false`)\n\nMakes the entire heading into the anchor link (takes precedence over `anchorLinkSymbol` and `anchorLinkBefore`)\n\n#### `resetIds`\n\n(default: `true`)\n\nAllows you to reset (or not) ids incrementation. Use it if you will have multiple\ndocuments on the same page.\n\n#### `slugify`\n\n(default: uses the [`uslug`](https://www.npmjs.com/package/uslug) package)\n\nAllows you to customize the slug function that create ids from string.\n\nEx:\n```js\n   // ...\n   slugify : string => `/some/prefix/${string.replace(/(\\/| |')/g, \"_\")}`\n   // ...\n```\n\n---\n\n## CONTRIBUTING\n\n* ⇄ Pull requests and ★ Stars are always welcome.\n* For bugs and feature requests, please create an issue.\n* Pull requests must be accompanied by passing automated tests (`$ npm test`).\n\n## [CHANGELOG](CHANGELOG.md)\n\n## [LICENSE](LICENSE)\n","publish_time":1546380477687,"_cnpm_publish_time":1546380477687,"dist-tags":{"latest":"4.2.0"}}