{"name":"@mdit-vue/plugin-sfc","version":"2.0.0","description":"A markdown-it plugin to help transforming markdown tu vue sfc","keywords":["markdown-it","markdown-it-plugin","vue","sfc"],"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":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./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":"2.0.0","@types/markdown-it":"^13.0.7","markdown-it":"^14.0.0"},"publishConfig":{"access":"public"},"gitHead":"25e4e00fdd43d7437b846c6adcc7e0b33c50281d","_id":"@mdit-vue/plugin-sfc@2.0.0","_nodeVersion":"18.17.1","_npmVersion":"lerna/3.1.0/node@v18.17.1+arm64 (darwin)","dist":{"integrity":"sha512-OXrMXOyk0iwdIou2jRoIHIbjskwghkO14C9/OjgVHXSSX+iM/WQ4l4yi1aWmNlbQNjtP8IXcVAyJB9K0DFYmLg==","shasum":"d47b27d71c43849ab990298833c2a630a2c61ccb","tarball":"http://registry-npm.ywwl.com/@mdit-vue/plugin-sfc/download/@mdit-vue/plugin-sfc-2.0.0.tgz","fileCount":8,"unpackedSize":15469,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgeDgEUEUvHJINSRaI7sw3FsuLtmv7ltrOEAKRZ6ttRAIhAO5GYUUvSGW/y77pQn5+MvxkthIcBqEidfjozx4MUrdf"}],"size":3511,"noattachment":false,"key":"/@mdit-vue/plugin-sfc/-/@mdit-vue/plugin-sfc-2.0.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-sfc_2.0.0_1702025299822_0.9219413711440188"},"_hasShrinkwrap":false,"readme":"# @mdit-vue/plugin-sfc\n\n[![npm](https://badgen.net/npm/v/@mdit-vue/plugin-sfc)](https://www.npmjs.com/package/@mdit-vue/plugin-sfc)\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 help transforming markdown to [Vue SFC](https://vuejs.org/guide/scaling-up/sfc.html).\n\n- Avoids rendering `<script>` and `<style>` tags and extract them into to markdown-it `env.sfcBlocks`.\n- Supports extracting custom blocks.\n- Provides `env.sfcBlocks.template` for convenience.\n\n## Install\n\n```sh\nnpm i @mdit-vue/plugin-sfc\n```\n\n## Usage\n\nThis plugin will only take effects when the `html` option of markdown-it is enabled:\n\n```ts\nimport { sfcPlugin } from '@mdit-vue/plugin-sfc';\nimport type { MarkdownItEnv } from '@mdit-vue/types';\nimport MarkdownIt from 'markdown-it';\n\nconst md = MarkdownIt({ html: true }).use(sfcPlugin, {\n  // options\n});\nconst env: MarkdownItEnv = {};\n\nconst rendered = md.render(\n  `\\\n# foo\n\n<script>\nconsole.log('bar')\n</script>\n`,\n  env,\n);\n\nconsole.log(env.sfcBlocks);\n```\n\n## Options\n\n### customBlocks\n\n- Type: `string[]`\n\n- Default: `[]`\n\n- Details:\n\n  SFC custom blocks to be extracted.\n\n  By default, only `<script>` and `<style>` tags will be extracted. You can set this option to support SFC custom blocks in markdown.\n\n  For example, if you set this option to `['i18n']`, the `<i18n>` tag in your markdown content will be extracted to `env.sfcBlocks.customBlocks` and won't appear in the rendered result.\n","publish_time":1702025300000,"_cnpm_publish_time":1702025300000,"dist-tags":{"latest":"4.0.0"}}