{"name":"@mdit-vue/plugin-headers","version":"0.9.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"},"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.9.0","@mdit-vue/types":"0.9.0","@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.19.1"},"publishConfig":{"access":"public"},"gitHead":"4279fc7ac1db0b585ffb395f55a07038af2a7263","_id":"@mdit-vue/plugin-headers@0.9.0","_nodeVersion":"16.15.1","_npmVersion":"lerna/1.8.0/node@v16.15.1+x64 (linux)","dist":{"integrity":"sha512-Or0jhBOb+jFliemt7sIknJnNp3TwKkD1W64QuMR5K32GQJILYvowhFcKTbtX/ELHcNrqhnN4zhsb/0biqtqaVQ==","shasum":"44929757b7c9b977f7e538645d20d54767b6fb30","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-headers/download/@mdit-vue/plugin-headers-0.9.0.tgz","fileCount":6,"unpackedSize":6657,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBtE6KOln2g7PJDVuw7/vih/cxoHqUPPHxRBSYwaH5i4AiEAsb3x43atQrmXhDd1nqPyuzer3rxSYB40y/Y2KxCdrAg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi38muACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqBpQ/+K5Lai6ZTfpc415G12ZdNqyeQptD3dpe2HAZ4kYd5c6BKCE3p\r\nkebtqGFlUEhu6i8EnLVdOFzMTVlLyjD04r64qDA7rdgV3YKLkGsHLJ9eB+6x\r\nAAkTO/opicCfsme4AJzuGyVP/1MhToqWNQughc74YuTLF7OFEWpD05bm6g/A\r\nkCXatkKwT0/bLvXWl4/gpmspFeWm8O8h1zmJ4zbW45guegemfQMt4TcERRUq\r\nXpuRp3q8EQ97jGBdy+E1qHk9aHNaxrnN45k1V59XNww1/mKOM3WS/xH9Ja1J\r\nMj3iL4z0jmWsyJAF15JsigEobl7Legb5Ubdxy9G0qMVPh4/EUwrrpYfEsK3S\r\n1uO9yMHMHVzN8jnAUwvG6nNhEMTpdT0s1WNf2/qdsq5s0a6VkjKA3xbt+6tV\r\njKgLdzAY9Mt4bqIu4g9vvgDPvxnsSALz0slKGqtsmpubpj87IZeliX8D2Z2E\r\nWNvhCsgcCRgPB4AXIbQSkAvPFB/q65N+jz7JWZ028bxDds6ZONxeUy32wp1C\r\nW5e4m/yyTYaYnMZYRdhg8h+2bgcE3LjYgV4URNJez8KlDesul2Ng2IA8dxy9\r\nxPCyIs2z4ZdKlyyCRAW1lg590SmQdrKsRADEvymXNz27zCPcThKzPJ21Rwwi\r\nX62wj085UbH8XWYvNOEmMfXAn9iN2RTyNUw=\r\n=mOed\r\n-----END PGP SIGNATURE-----\r\n","size":2670,"noattachment":false,"key":"/@mdit-vue/plugin-headers/-/@mdit-vue/plugin-headers-0.9.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.9.0_1658833326645_0.3009996885179911"},"_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":1658833326933,"_cnpm_publish_time":1658833326933,"dist-tags":{"latest":"4.0.0"}}