.This Vite plugin adds support for importing a Fall documents as a Vue part. Performs with Vue 2 & 3.Vue.js Demo Blocks.Provide your Vue.js code blocks inline by merely adding trial alongside the language label.For example, when this Accounting allowance documents is actually provided using this plugin, you'll see a clickable switch here:."' vue demonstration.
Click me."'( end).Set up.npm set up -D vite-vue-md.Setup.In your vite.config.js file:.Bring in vite-vue-md as well as incorporate it to the plugins variety.In your vue() plugin alternatives, include a consist of choice that includes.md files.vite.config.js:.bring in vue from '@vitejs/ plugin-vue'.+ bring in vueMd coming from 'vite-vue-md'.export default plugins: [// ...vue( + include: [/. vue$/,/ . md$/]// u2190 Deal with MD reports as Vue components. ),.+ vueMd(/ * Options */)// u2190 Put together MD documents to Vue elements.]// ...To organize a Vue.js codeblock as a Demo Block, incorporate demo beside the foreign language title:."' vue demonstration.
Click me."'( end).Multi-file trials.The admittance aim for demo blocks have to be a Vue.js component. Yet you can import various other code shuts out in any kind of foreign language from the very same Accounting allowance documents.For non-entry data, put a file label through trial=. At that point import it from the Vue.js demonstration block using the doctor: process:.
Click me.
2nd data:.demonstration= click-handler. js.export const clickHandler = () => sharp(' Clicked on!').Demonstration + Code obstructs.Because the code blocks are actually delivered inline, they are actually substituted by the actual Vue.js component. To present the code block, you can easily include a onDemo callback to the plugin options:.( onDemo( componentTag, code) // Sign up the wrapper element.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Profits a customized HTML strand.return '.$ componentTag
$ this.escapeHtml( code)'. ).Possibilities.consist of.Type: ReadonlyArray|string|RegExp.Files to feature from being assembled as Vue reports.exclude.Style: ReadonlyArray|string|RegExp.Reports to omit coming from being actually assembled as Vue documents.markdownItOptions.Kind: markdownIt.Options.MarkdownIt options. Go to MarkdownIt's paperwork to read more.markdownItSetup.Kind: (md: markdownIt) => space.Callback to include plugins to MarkdownIt.wrapperClass.Type: string.Default: markdown-body.The training class to contribute to the cover aspect that contains the Markdown page.onDemo.Kind:.(.tag: cord,.code: string,.demonstrations: Chart.) => string.You can easily obstruct each demo block as well as return a personalized HTML cord. This is useful for incorporating custom designing to demo blocks.On top of that, there are actually utils exposed in the this circumstance:.escapeHtml: Escape HTML code to prevent it from being actually made as HTML.registerComponent: Sign up an element to become utilized in the demonstration block. This is useful for registering components that are imported from various other files.Observe example over in the Demo Blocks segment.markdownCss.Style: chain.Submit road to a stylesheet to make use of for the Markdown webpage. This will definitely be incorporated making use of so it is going to only relate to the markdown page. Beneficial for designating just the HTML created by the MarkdownIt plugin.useVOnce.Kind: boolean.Whether to add v-once to the whole entire Accounting allowance page. This are going to stop the Markdown webpage from being re-rendered when the Vue component is actually updated.Alert: This will certainly disable demonstration blocks. Only utilize this if you possess a sizable document and also do not need to have demo blocks.Associated.unplugin-vue-markdown.An additional Vite plugin for collecting Markdown files to Vue parts.This plugin has drawn motivation coming from it however has a various component set. This plugin only supports Vue.js code in code blocks.Github.Perspective Github.