{"name":"@mdit-vue/plugin-headers","version":"0.11.2","description":"A markdown-it plugin to get markdown headers","keywords":["markdown-it","markdown-it-plugin","vue","header","heading"],"homepage":"https://github.com/mdit-vue","bugs":{"url":"https://github.com/mdit-vue/mdit-vue/issues"},"repository":{"type":"git","url":"git+https://github.com/mdit-vue/mdit-vue.git"},"license":"MIT","author":{"name":"meteorlxy","email":"meteor.lxy@foxmail.com"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","scripts":{"build":"unbuild","test":"vitest"},"dependencies":{"@mdit-vue/shared":"0.11.2","@mdit-vue/types":"0.11.0","@types/markdown-it":"^12.2.3","markdown-it":"^13.0.1"},"devDependencies":{"markdown-it-anchor":"^8.6.6"},"publishConfig":{"access":"public"},"gitHead":"676ec4ca8704d709e7a47f7f6d41ff3f70dc2356","_id":"@mdit-vue/plugin-headers@0.11.2","_nodeVersion":"16.18.0","_npmVersion":"lerna/1.13.0/node@v16.18.0+arm64 (darwin)","dist":{"integrity":"sha512-hH2zm4m+2tWe7dya/nxbbpB95pa9RjwYxl++kyZuRrqyhNTtsi2HWojX02peQ1nQMKKIWPDHtpeAHGP7dOLKFw==","shasum":"dd7ca7d00a6b2e28d516ba83718c6e336995d125","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-headers/download/@mdit-vue/plugin-headers-0.11.2.tgz","fileCount":6,"unpackedSize":6325,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCoIi6wACcTXtgneCGUZNgQaLnk5JTt2Fr0eglpzaYVmgIhAJN7R/pd83bwF5hIZz5+/62iXPECSBTHvdNSbMmZafp+"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjpQjdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqAiw/9EqSNTsv+B+QGqmDrVDZEUF+e3YoGNpM3cXMb6Xsp1OT8JMKm\r\n7XUwxN4Q0jrPX1GsBkYkMnZiLBD5piecq+t20DbswgjabSOduVKa7UGOLDgV\r\niQdsn4C+QEp8ZebzaDDXNcPzMhYSkOIkjj09+0BxKaQW/kYMEX7I1zR6G6YJ\r\nInA4GHuaz9iFPDCSibh0Z6QwjsScS42UH8UnoOpC+fgYuU0z2Qp4G2WpP4C7\r\nOLTwz8iUIHISBTVKZ6c2OZhw+DHOhXZsrrJ7tv2n1Dc1rvRlCK84sFs9s8NK\r\nXkRc2epzW3OL3a8D2zl2k+sWEDeFnn0VKwrFY0tVA3O0GomQZZFgEN4PdZhK\r\nxGirKjK8r9fgcRcAx7lcgTDvEBG8qkv/03ked9Hyuyx7jFPHCJOcmQGjd4EW\r\nUKxS7fd+R9WCdEjvYIfUHMMesCR54WsGbgvaKzEh5vIkAgBVFCJYfXWpDRHK\r\nL/pET3oLG0lXKHkRyXZFBth9Y/uVJqDmo7hGTYeGmAgV+m1x7DfGVIPj9LLW\r\n/v7iFZDrd4m5K/Yp/ugUq2Fz7kF1RwQgF0mDFc8EYe3DdztizBuPW8PH0lUI\r\nMBg69X5LpnGsoWgTu/3wDJcIMtxExs30CVMxaxh89nGMvx/E1X0OLttXI6wI\r\n314SDc8kBckjCk8jpMZLWXlem4uN5drNJ1E=\r\n=Id/5\r\n-----END PGP SIGNATURE-----\r\n","size":2551,"noattachment":false,"key":"/@mdit-vue/plugin-headers/-/@mdit-vue/plugin-headers-0.11.2.tgz"},"_npmUser":{"name":"meteorlxy","email":"meteor.lxy@foxmail.com"},"directories":{},"maintainers":[{"name":"meteorlxy","email":"meteor.lxy@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-headers_0.11.2_1671760093530_0.6805230256146928"},"_hasShrinkwrap":false,"readme":"# @mdit-vue/plugin-headers\n\n[![npm](https://badgen.net/npm/v/@mdit-vue/plugin-headers)](https://www.npmjs.com/package/@mdit-vue/plugin-headers)\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 get markdown headers.\n\n- Extracts all headers info into markdown-it `env.headers`.\n\n## Install\n\n```sh\nnpm i @mdit-vue/plugin-headers\n```\n\n## Usage\n\n```ts\nimport { headersPlugin } from '@mdit-vue/plugin-headers';\nimport type { MarkdownItEnv } from '@mdit-vue/types';\nimport MarkdownIt from 'markdown-it';\n\nconst md = MarkdownIt({ html: true }).use(headersPlugin, {\n  // options\n});\nconst env: MarkdownItEnv = {};\n\nconst rendered = md.render(\n  `\\\n# h1\n## h2\n### h3\n`,\n  env,\n);\n\nconsole.log(env.headers);\n```\n\n## Options\n\n### format\n\n- Type: `(str: string) => string`\n\n- Details:\n\n  A function for formatting header title.\n\n### level\n\n- Type: `number[]`\n\n- Default: `[2, 3]`\n\n- Details:\n\n  Heading level that going to be extracted.\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 header slugs 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 extracted.\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","publish_time":1671760093709,"_cnpm_publish_time":1671760093709,"dist-tags":{"latest":"4.0.0"}}