{"name":"@mdit-vue/plugin-headers","version":"0.7.1","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.7.1","@mdit-vue/types":"0.7.1","@types/markdown-it":"^12.2.3","markdown-it":"^13.0.1"},"devDependencies":{"c8":"^7.12.0","markdown-it-anchor":"^8.6.4","unbuild":"^0.7.6","vitest":"^0.18.1"},"publishConfig":{"access":"public"},"gitHead":"b4b8bc6c054ea2dd9ad9ec7a37a58b5a2147b2bd","_id":"@mdit-vue/plugin-headers@0.7.1","_nodeVersion":"16.14.2","_npmVersion":"lerna/1.6.0/node@v16.14.2+x64 (linux)","dist":{"integrity":"sha512-Cjt8fYwImPL7ZwM4DoYR3iIRg9S+G+YltvUSTO54D2lSFnFfyaa9+vHandg6XPfG4hMjPTFoz0wq6ZtpWePjBQ==","shasum":"26defe81e9fad9bbae960578a91ddffa04f64328","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-headers/download/@mdit-vue/plugin-headers-0.7.1.tgz","fileCount":6,"unpackedSize":6654,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9HP64isF6ScRYdKWGG5qTZJPKGeW9/RX1vLVMNY5mGwIgUQsjypWk1VD975cHdOE4DTkhp3iAUQmo4uZsTvMmboA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2DX2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2FA//Y94NhlZl0eVaoaJITF8s0r4HZFIX48sAG7RyfJ89Om8ypbip\r\nsqz9u6/rs6+KbuDqLZc0UyGYJMZjpFtW1Ky56bT8oqSK17eZaJFx+4s36nD4\r\nhFiJe8VhPnFeW5DZIlYVP4Dyb+gnZIpXSet4jJ3eI6zvgCbpNwx92sjcPcGZ\r\nzDmLUmeW+8Yc9ci6XrvHVMC6OpCGzHeaCYoT9kFXqFOk3Cor1OTJQnoM6iSd\r\nXtscZ1VTMi5N1E5Vc2nP1egZrkd5VuuYrpnTb15keVvoV6EdzA54JxQWCW2c\r\nKkesBnzf1wVz5FF1wdz0xPNGDKY4sXLMzZuTq3oE9qRKphORPtr1grgUtmc/\r\nx0DRXmiAV7DxhmaPV2R6kY3cskElVjosOh+bc6pA24Q7aThQUTkRmnu/Uqgo\r\neVRGN1CcCrnMJ+1vxtdLB8pBdLCLp3tHhYMHb+axWKapzaFK+IN7xBfbEFnA\r\n8l3ryP3ktdzax5uQjYAcMnmtPA+mX2Ipu7c8yZ6gglZ8u6m2vQwm6U//csl8\r\n7BOnR6vSkT3j7zmlaAW9BOGXM7Jse6nhr6ZZzObDGUNp1obmMlgVD1zYMiVd\r\n31xCTw1VW711xrKOhgmPj4ncngpB3+OLDLTlgHnWMVtC4nJHlLE2dXJbsCaB\r\nEebmMd71UsP71M9zGHZgthiYJH6XYS9CZNw=\r\n=w0g6\r\n-----END PGP SIGNATURE-----\r\n","size":2665,"noattachment":false,"key":"/@mdit-vue/plugin-headers/-/@mdit-vue/plugin-headers-0.7.1.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.7.1_1658336758784_0.8314553182470432"},"_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":1658336758957,"_cnpm_publish_time":1658336758957,"dist-tags":{"latest":"4.0.0"}}