{"name":"@mdit-vue/plugin-toc","version":"3.0.1","keywords":["markdown-it","markdown-it-plugin","vue","toc","table-of-contents"],"author":{"name":"meteorlxy","email":"meteor.lxy@foxmail.com"},"license":"MIT","_id":"@mdit-vue/plugin-toc@3.0.1","maintainers":[{"name":"meteorlxy","email":"meteor.lxy@foxmail.com"}],"homepage":"https://github.com/mdit-vue","bugs":{"url":"https://github.com/mdit-vue/mdit-vue/issues"},"dist":{"shasum":"7d7660e2a8414bb34e45e0cdc853bb25028cb91f","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-toc/download/@mdit-vue/plugin-toc-3.0.1.tgz","fileCount":5,"integrity":"sha512-q5MFNTxXfmrYtw7C3qvTjj2Kv0+rhme5+3knucUjCR1Fpnu8+kducxQUclIahhgjuTdTDmdjSfepKRTTnxQAyQ==","signatures":[{"sig":"MEYCIQDVLaHobF7tsZEvLAHXj87xR2tMZ57nOY9rTTvcp/8eegIhAL2PzPh/d5ZgSb1xRf0EQrcnHt5IVyKgLGdOpJLcwe7o","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11904,"size":4128,"noattachment":false,"key":"/@mdit-vue/plugin-toc/-/@mdit-vue/plugin-toc-3.0.1.tgz"},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20.0.0"},"exports":{".":"./dist/index.js","./package.json":"./package.json"},"gitHead":"cdffe386ef7b897f1bf878ce20e38bdd07908fb1","scripts":{"test":"vitest","build":"tsdown"},"_npmUser":{"name":"meteorlxy","email":"meteor.lxy@foxmail.com"},"repository":{"url":"git+https://github.com/mdit-vue/mdit-vue.git","type":"git"},"_npmVersion":"lerna/4.7.0/node@v22.17.0+arm64 (darwin)","description":"A markdown-it plugin to generate table-of-contents that compatible with Vue.js","directories":{},"_nodeVersion":"22.17.0","dependencies":{"markdown-it":"^14.1.0","@mdit-vue/types":"3.0.1","@mdit-vue/shared":"3.0.1","@types/markdown-it":"^14.1.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.14.0","vitest":"^3.2.4","markdown-it-anchor":"^9.2.0"},"_npmOperationalInternal":{"tmp":"tmp/plugin-toc_3.0.1_1754926946945_0.5797742428733543","host":"s3://npm-registry-packages-npm-production"},"readme":"# @mdit-vue/plugin-toc\n\n[![npm](https://badgen.net/npm/v/@mdit-vue/plugin-toc)](https://www.npmjs.com/package/@mdit-vue/plugin-toc)\n[![license](https://badgen.net/github/license/mdit-vue/mdit-vue)](https://github.com/mdit-vue/mdit-vue/blob/main/LICENSE)\n\nA [markdown-it](https://github.com/markdown-it/markdown-it) plugin to generate table-of-contents (TOC) that compatible with [Vue.js](https://vuejs.org).\n\nThis plugin is basically a fork of [markdown-it-toc-done-right](https://github.com/nagaozen/markdown-it-toc-done-right), with following enhancement:\n\n- Allows `html_inline` tags in headings to support vue components.\n- Supports [containerTag](#containertag), [listTag](#listtag) and [linkTag](#linktag).\n- Only allows array in [level](#level) option.\n- Code refactor and optimizations.\n\n## Install\n\n```sh\nnpm i @mdit-vue/plugin-toc\n```\n\n## Usage\n\n```ts\nimport { tocPlugin } from '@mdit-vue/plugin-toc';\nimport MarkdownIt from 'markdown-it';\n\nconst md = MarkdownIt({ html: true }).use(tocPlugin, {\n  // options\n});\n```\n\n## Options\n\n### pattern\n\n- Type: `RegExp`\n\n- Default: `/^\\[\\[toc\\]\\]$/i`\n\n- Details:\n\n  The pattern serving as the TOC placeholder in your markdown.\n\n### slugify\n\n- Type: `(str: string) => string`\n\n- Default: `slugify` from `@mdit-vue/shared`\n\n- Details:\n\n  A custom slugification function.\n\n  The default slugify function comes from [@mdit-vue/shared](https://github.com/mdit-vue/mdit-vue/tree/main/packages/shared) package.\n\n  When using this plugin with [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor) (recommended), this option will be ignored because the `id` of the headings have already been determined by markdown-it-anchor's `slugify` option.\n\n### format\n\n- Type: `(str: string) => string`\n\n- Details:\n\n  A function for formatting headings.\n\n### level\n\n- Type: `number[]`\n\n- Default: `[2, 3]`\n\n- Details:\n\n  Heading level that going to be included in the TOC.\n\n  When using this plugin with [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor) (recommended), this option should be a subset of markdown-it-anchor's `level` option to ensure the target links are existed.\n\n### shouldAllowNested\n\n- Type: `boolean`\n\n- Default: `false`\n\n- Details:\n\n  Should allow headers inside nested blocks or not.\n\n  If set to `true`, headers inside blockquote, list, etc. would also be included.\n\n### containerTag\n\n- Type: `string`\n\n- Default: `'nav'`\n\n- Details:\n\n  HTML tag of the TOC container.\n\n### containerClass\n\n- Type: `string`\n\n- Default: `'table-of-contents'`\n\n- Details:\n\n  The class for the TOC container.\n\n### listTag\n\n- Type: `'ul' | 'ol'`\n\n- Default: `'ul'`\n\n- Details:\n\n  HTML tag of the TOC list.\n\n### listClass\n\n- Type: `string`\n\n- Default: `''`\n\n- Details:\n\n  The class for the TOC list.\n\n### itemClass\n\n- Type: `string`\n\n- Default: `''`\n\n- Details:\n\n  The class for the `<li>` tag.\n\n### linkTag\n\n- Type: `'a' | 'router-link'`\n\n- Default: `'a'`\n\n- Details:\n\n  The tag of the link inside the `<li>` tag.\n\n  You can set this option to render to links as [vue-router's router-link](https://router.vuejs.org/guide/#html).\n\n### linkClass\n\n- Type: `string`\n\n- Default: `''`\n\n- Details:\n\n  The class for the link inside the `<li>` tag.\n","publish_time":1754926947143,"_cnpm_publish_time":1754926947143,"dist-tags":{"latest":"4.0.0"}}