{"name":"markdown-it-toc-and-anchor","version":"1.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"},"homepage":"https://github.com/MoOx/markdown-it-toc-and-anchor","bugs":{"url":"https://github.com/MoOx/markdown-it-toc-and-anchor/issues"},"main":"dist/index.js","dependencies":{"markdown-it":"^4.2.1"},"devDependencies":{"babel":"^5.4.7","babel-eslint":"^3.1.9","babel-tape-runner":"^1.1.0","eslint":"^0.22.1","tape":"^4.0.0"},"scripts":{"lint":"eslint .","tape":"babel-tape-runner '__tests__/*.js'","test":"npm run lint && npm run tape","prepublish":"babel src --out-dir dist"},"gitHead":"4e4ada7fffb04418331b56e09dc4b563f9fe5bab","_id":"markdown-it-toc-and-anchor@1.0.0","_shasum":"f2de8bdf37055eb933fafc1a4edc6529c6af5e83","_from":".","_npmVersion":"2.9.0","_nodeVersion":"2.0.1","_npmUser":{"name":"moox","email":"m@moox.io"},"maintainers":[{"name":"moox","email":"m@moox.io"}],"dist":{"shasum":"f2de8bdf37055eb933fafc1a4edc6529c6af5e83","tarball":"http://registry-npm.ywwl.com/markdown-it-toc-and-anchor/download/markdown-it-toc-and-anchor-1.0.0.tgz","integrity":"sha512-QXFYHhBL0A9/hnD17mh3m/hX+CSgvb8wO4qujcRXZriPnX7imvUVZVs38AZW1KBGhBn5ErnjAGZqugz5UnGc9Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD6BLuBS42InYPpZXHmgu+4jlRtSi/7uEbRrSVAWas7xAIgdOsGmXQxGapZZ0vnY6D8racG+WyIJk01JefuRlmH4eM="}],"size":5696,"noattachment":false,"key":"/markdown-it-toc-and-anchor/-/markdown-it-toc-and-anchor-1.0.0.tgz"},"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":1433315244734,"_cnpm_publish_time":1433315244734,"dist-tags":{"latest":"4.2.0"}}