{"name":"@mdit-vue/plugin-frontmatter","version":"0.7.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"},"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.7.0","@types/markdown-it":"^12.2.3","gray-matter":"^4.0.3","markdown-it":"^13.0.1"},"devDependencies":{"c8":"^7.11.3","unbuild":"^0.7.4","vitest":"^0.18.1"},"publishConfig":{"access":"public"},"gitHead":"dd30ddd75ca461f775ccc35556132851ebc5e58a","_id":"@mdit-vue/plugin-frontmatter@0.7.0","_nodeVersion":"16.14.2","_npmVersion":"lerna/1.6.0/node@v16.14.2+x64 (linux)","dist":{"integrity":"sha512-L7VOyilYkHM8lX/de0I3huXPvo6FpQnsM9irHloCjxFjGWjQGQPVgKwlmuUiEnoszP91bGOcFazRUuESonZIxg==","shasum":"9ef47675dbc4e57018134e82ddea43d0a0a78e9d","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-frontmatter/download/@mdit-vue/plugin-frontmatter-0.7.0.tgz","fileCount":12,"unpackedSize":13091,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHsfC5OjIujWL71VVnw3wzFwsJC1gKdUkWoBBP640Bd5AiEAxkiJyCXEEp6v/ZRlFH2oRJtcWk6ctz+qkQjIu2Idedk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi1XHGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpkWxAAgxCoiHJBSLGG61utQ2DxGBPEkjReWD1tekZlwPvDtG0YUCDs\r\nXxJ5LgaRfRRSf5gbFurH8GXrqCQnDTnU6w+2LaexnWF+MKhxxrwvlIBTXLe3\r\nb99+W3o7ANWoys+INUx+RMMV0DOT75j+UadqivS6vJErPqEaokP8FrwlOhFp\r\nYg9jr/OlQy8xWRfBdXmHO005Ospz5kyNJ0mjREGcYWE0Ey37EkYfc0UUEjcU\r\ni7DdmjfROUZv9MOEzpRV4BzIxXSXr9azNyxTI9QbHDLQPxOUZiQ99L3nHLkg\r\nzv6pLbTb8fvpDzVOfI1gb0d7TbvtYrcNCVezW3MA6dv8Ln7BONoO/J7Dx/+g\r\nV+qjHJuEUy20edxxa/PZFPhAFQ8nf3EvUhTZkTZ59EQUJHWtY+mPNLN3b/DN\r\n0vorvdbBGabMHctvMaqTMCSIv/dqL3JSUmgCStVH/SDuOL1jhbHb0JsFzGTy\r\nHGHPG/4XA7Ksb7AQ2ERTsMahuNJRXLCTlJ6TSkPetq3K2S/zL8kWxwzeUsPE\r\nf/G+VIOsdJCrEZHoGwDitr0b47ibTtUawN8K8StexXMeNoJ19Kqf2tmRpr0Z\r\nn+KVAhlRIDNVheikAwS0sj3bnyrjwopL9U0gyFU8kMqyddwP5tasc581s0c6\r\nXshssp2vfIpeATCC70iswsWwUX/hrcNqtTQ=\r\n=6F0d\r\n-----END PGP SIGNATURE-----\r\n","size":4192,"noattachment":false,"key":"/@mdit-vue/plugin-frontmatter/-/@mdit-vue/plugin-frontmatter-0.7.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.7.0_1658155462681_0.6777899952983573"},"_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":1658155462848,"_cnpm_publish_time":1658155462848,"dist-tags":{"latest":"4.0.0"}}