{"name":"@mdit-vue/plugin-headers","version":"0.4.0","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"},"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.4.0","@types/markdown-it":"^12.2.3","markdown-it":"^13.0.1"},"devDependencies":{"c8":"^7.11.3","markdown-it-anchor":"^8.6.4","unbuild":"^0.7.4","vitest":"^0.16.0"},"publishConfig":{"access":"public"},"gitHead":"744887e6f4733af8da2045625e72a476947cfc25","_id":"@mdit-vue/plugin-headers@0.4.0","_nodeVersion":"16.14.2","_npmVersion":"lerna/1.6.0/node@v16.14.2+x64 (linux)","dist":{"integrity":"sha512-pkVbsoYzNqmk7OGST0fodqL+5yxRkvrVFj2zzbn1VL+OYLqWnJvXwiFdagpimRqVe2fHsf3MPVvYDZC5i53KEg==","shasum":"c155f58c7abb542e74ad10b0b4e1a7c5d8294409","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-headers/download/@mdit-vue/plugin-headers-0.4.0.tgz","fileCount":13,"unpackedSize":16365,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDLvobGxIHw3R/m67GclT3dN0Wb+AaocCcdPPzJqMc79QIhANud1gwbuP6RTBsCSGLkJ9fPFxDDpC3tt0tj1OeXMxZz"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiwHmiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqXtQ/+K0ftaFizRgIzcn0qRtOeg4wwrZkDNu9Danf7CaehzZaLsFws\r\nKZKtg/h0kagT6yehx7q+9YSv04XKlbkxs671sEV+R82heAOz23vCVIKM0TcD\r\nFfepUpIfKuJLcPRJq4B5HVfpeRo5iKCdvCzy8Zi496ZoRSnjO6GfsXnFazQV\r\nYKtJzXOzhHd1pRf7fnKrNpA0QjvKWSy71Rw/XuaC+GK1ZXY4Kcb0f3ZEEeG4\r\nNDatAzXcqbqionDDIOL/qONjySEvFUz44K5bp/Hl9NmQ4F4Ht9xFbzCYcLG1\r\nxAe9Ub+F6+a1yq0ODm02EaWyAo/Ft2Gurk4ho9gatB6dzgCEaKDz+7YT5dH8\r\nd8bRvrApgHxvFfEpevIk2UKE8ZNFTxJmRnVuneLmbWVhmxSp9xlXfk5SvF3y\r\nDg19dIfgL4StaFJlQDggs1RawBlhRVF/AEGQq5wQXioActemHE8lhwR8r9iC\r\nwOYtYlh6hl82MnOm55I8EIJds8v9Z/xtYTOn23uRad9uWqr89fGQ6TVpZbkE\r\nUZup7y+HGmuS2TlFYhWSrzjOOen0yJvQyqajdIbX6Bhv3W9H4yY7bfN2W5GX\r\n7+jM3TDxPpC5J9oWB5RyRMqv5GoomhKquZurxL6JfmFR902Y47e2RDQe4d6N\r\nupKEQniKCJ9KJCYyI/zKwdkrePBvXNNd/cM=\r\n=7tBj\r\n-----END PGP SIGNATURE-----\r\n","size":4458,"noattachment":false,"key":"/@mdit-vue/plugin-headers/-/@mdit-vue/plugin-headers-0.4.0.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.4.0_1656781218838_0.1804296533184382"},"_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":1656781218958,"_cnpm_publish_time":1656781218958,"dist-tags":{"latest":"4.0.0"}}