{"name":"@mdit-vue/plugin-frontmatter","version":"0.10.0","description":"A markdown-it plugin to get markdown frontmatter","keywords":["markdown-it","markdown-it-plugin","vue","frontmatter","excerpt"],"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/types":"0.10.0","@types/markdown-it":"^12.2.3","gray-matter":"^4.0.3","markdown-it":"^13.0.1"},"publishConfig":{"access":"public"},"gitHead":"94289f16c4e5c5cb24e05016f67bba2241b3ada9","_id":"@mdit-vue/plugin-frontmatter@0.10.0","_nodeVersion":"16.14.2","_npmVersion":"lerna/1.11.0/node@v16.14.2+x64 (linux)","dist":{"integrity":"sha512-rJa4QM04YKRH9Edpr07BZvOjzOH2BwkPkalIa8YFIsZkCXLmrPpLsQteXbRLTkLGHLXnniW4V4tn5Y7bf7J74g==","shasum":"0f8bbf819ac8501dedfa3ba3d74e12dcc7cc0445","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-frontmatter/download/@mdit-vue/plugin-frontmatter-0.10.0.tgz","fileCount":6,"unpackedSize":6911,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHGNncn0g1nK051IIkVEOFtGps75DRiJVA4lNN0K4g7eAiAkfSX40sSaR98hNJ6L9EmVT4k4Zmsg5iG+bmRftmewxw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjBQzCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq9yw/+Lcp2IUurDiIRPdkJu2axa04zBwbRIGzQmc0V4nE0bYE1FjGn\r\nI4Co4X56mfk/GNG2iOLgPbpZ82LRTlG2kMP/opEelhTLuIEAfF3NQmFjQT02\r\nemz0qQZO8fzPc2be6uD9A5alcPt9kWVVpo5qu/J+3GcOsCLI5bFCEItuJ6JN\r\n7vuJ0lJ1hMgMvN8hFNhXCRy1YkAK2sF2ONdj5hS/Q6kIBpRUohMLalArzE+h\r\nvDmGgsMzSU/VMfDIINQkKfqGOS8hN3utLY8CoHEbMAcsfb8/bbmPOQ7Lca4z\r\nlt+I+t7ElcOOtbzkl84/jYTA14OHS7qjiGvydMnkqW4dn1L33/o4CLUHZPJ5\r\nln7gVM0caGGIh0YvYJwSdODRBHntjrkJlJSFDOhKo7wxqdM6YrceWFF9inbO\r\nViPZRqW2i/hitAHVEODwYOv1FCvwIvmC16JxM4EmzDAZhuCrPbYvwWJJSM9I\r\nV9NPTdEhz//+3J0f6gDfLkB6lkdoBdM70AZbRS6JN5NRwJQKYOWQB51VoXaN\r\nml4hXRA/xqIeV9IJTCxSqjddGhVN7cR1IXUuR5XBerSWcsr5ak0yDd6p7DZy\r\nYYBZji9isX/mIFDY7ditvLnc3pncfTk7VZhr05rsIWwDQH87ZgOs3VkDT3UE\r\naCCXaoKPRj+v7JzigollakR2VDzyM1gyENU=\r\n=WIo3\r\n-----END PGP SIGNATURE-----\r\n","size":2717,"noattachment":false,"key":"/@mdit-vue/plugin-frontmatter/-/@mdit-vue/plugin-frontmatter-0.10.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-frontmatter_0.10.0_1661275330266_0.6547848937031797"},"_hasShrinkwrap":false,"readme":"# @mdit-vue/plugin-frontmatter\n\n[![npm](https://badgen.net/npm/v/@mdit-vue/plugin-frontmatter)](https://www.npmjs.com/package/@mdit-vue/plugin-frontmatter)\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 frontmatter with [gray-matter](https://github.com/jonschlinkert/gray-matter).\n\n- Extracts frontmatter into markdown-it `env.frontmatter`.\n- Allows providing default frontmatter via markdown-it `env.frontmatter`.\n- Extracts markdown content without frontmatter into markdown-it `env.content`.\n- Supports extracting rendered excerpt into markdown-it `env.excerpt`.\n\n## Install\n\n```sh\nnpm i @mdit-vue/plugin-frontmatter\n```\n\n## Usage\n\n```ts\nimport { frontmatterPlugin } from '@mdit-vue/plugin-frontmatter';\nimport type { MarkdownItEnv } from '@mdit-vue/types';\nimport MarkdownIt from 'markdown-it';\n\nconst md = MarkdownIt({ html: true }).use(frontmatterPlugin, {\n  // options\n  grayMatterOptions: {\n    excerpt: true,\n    excerpt_separator: '<!-- more -->',\n  },\n});\nconst env: MarkdownItEnv = {};\n\nconst rendered = md.render(\n  `\\\n---\ntitle: foobar\n---\n\nEverything above **more** comment will be extracted as excerpt.\n\n<!-- more -->\n\nThings below **more** comment will not be included in the excerpt.\n`,\n  env,\n);\n\nconsole.log(env.frontmatter);\nconsole.log(env.content);\nconsole.log(env.excerpt);\n```\n\n## Options\n\n### grayMatterOptions\n\n- Type: `GrayMatterOptions`\n\n- Details:\n\n  Options of [gray-matter](https://github.com/jonschlinkert/gray-matter).\n\n### renderExcerpt\n\n- Type: `boolean`\n\n- Default: `true`\n\n  Render the [excerpt](https://github.com/jonschlinkert/gray-matter#optionsexcerpt) with markdown-it or not.\n\n  This option will only take effects when `grayMatterOptions.excerpt` is enabled (disabled by default) or `grayMatterOptions.excerpt_separator` is set (undefined by default).\n","publish_time":1661275330444,"_cnpm_publish_time":1661275330444,"dist-tags":{"latest":"4.0.0"}}