{"name":"markdown-it-toc-and-anchor","version":"3.0.0","description":"markdown-it plugin to add toc and anchor links in headings","keywords":["makrdown-it","makrdown-it-plugin","makrdown","toc","anchor"],"author":{"name":"Maxime Thirouin"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/MoOx/markdown-it-toc-and-anchor.git"},"main":"dist/index.js","files":["dist","src","!**/__tests__"],"dependencies":{"uslug":"^1.0.3"},"devDependencies":{"ava":"^0.10.0","babel-cli":"^6.4.0","babel-core":"^6.4.0","babel-eslint":"^4.1.6","babel-preset-es2015":"^6.3.13","babel-preset-stage-2":"^6.3.13","eslint":"^1.10.3","eslint-config-i-am-meticulous":"^1.0.0","markdown-it":"^5.0.0","npmpub":"^3.1.0"},"scripts":{"lint":"eslint .","tests":"ava '**/__tests__/*.js'","test":"npm run lint && npm run tests","prepublish":"babel --ignore __tests__ src --out-dir dist","release":"npmpub"},"babel":{"presets":["es2015","stage-2"]},"eslintConfig":{"extends":["eslint-config-i-am-meticulous"]},"ava":{"require":["babel-core/register"]},"gitHead":"d3e22fb0b9f72ac72912669dcfc7444290ddf36a","bugs":{"url":"https://github.com/MoOx/markdown-it-toc-and-anchor/issues"},"homepage":"https://github.com/MoOx/markdown-it-toc-and-anchor#readme","_id":"markdown-it-toc-and-anchor@3.0.0","_shasum":"380d35329054db9c1a61a8724f138fa627bb7204","_from":".","_npmVersion":"3.8.3","_nodeVersion":"5.10.0","_npmUser":{"name":"moox","email":"m@moox.io"},"maintainers":[{"name":"moox","email":"m@moox.io"}],"dist":{"shasum":"380d35329054db9c1a61a8724f138fa627bb7204","tarball":"http://registry-npm.ywwl.com/markdown-it-toc-and-anchor/download/markdown-it-toc-and-anchor-3.0.0.tgz","integrity":"sha512-Jcdy5cYcSmZqZ23E71XedtnNps1cXYOeD1uCT+kGWFu5tDDg7i+xwZgOGRVsM/rpEQrTRZMRWxIt92bMJ+jQKw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA9E5mcqNachOt10pZkJZmS8qi7sc/EYNjEO9jpG+s36AiEA9Nx+H9WJJQM7DESdNwX9WDHk2ul21Zpq3970350VBf8="}],"size":6061,"noattachment":false,"key":"/markdown-it-toc-and-anchor/-/markdown-it-toc-and-anchor-3.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/markdown-it-toc-and-anchor-3.0.0.tgz_1459801792234_0.26812662463635206"},"directories":{},"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":1459801794713,"_cnpm_publish_time":1459801794713,"dist-tags":{"latest":"4.2.0"}}