{"name":"@mdit-vue/plugin-headers","version":"3.0.1","keywords":["markdown-it","markdown-it-plugin","vue","header","heading"],"author":{"name":"meteorlxy","email":"meteor.lxy@foxmail.com"},"license":"MIT","_id":"@mdit-vue/plugin-headers@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":"e72d71b2b891cdcc1f1526fe00c90e08775fbb12","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-headers/download/@mdit-vue/plugin-headers-3.0.1.tgz","fileCount":5,"integrity":"sha512-gyXk9FY+CGM9nPg3nUgvTiI+mgs1lFnLfvMebnrJCi0fXexODYCJgM4uUkt6P6+oCZk4i2GoHTOdZcr+zI7RnQ==","signatures":[{"sig":"MEQCID0GQHpWm0qarxdKZN/4vmRSopMwrcTj1sCEALRQXToDAiBkcNs3/DBqoO33dgzJ95iIyft7oWHWTaUUED0WqnFhvQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6385,"size":2689,"noattachment":false,"key":"/@mdit-vue/plugin-headers/-/@mdit-vue/plugin-headers-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 get markdown headers","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-headers_3.0.1_1754926946507_0.5130162612230342","host":"s3://npm-registry-packages-npm-production"},"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":1754926946770,"_cnpm_publish_time":1754926946770,"dist-tags":{"latest":"4.0.0"}}