.This Vite plugin adds support for importing a Markdown documents as a Vue element. Performs along with Vue 2 & 3.Vue.js Demo Blocks.Make your Vue.js code shuts out inline through simply adding demo alongside the language name.For instance, when this Fall report is actually provided with this plugin, you'll view a clickable button below:."' vue demo.
Click me."'( end).Put up.npm mount -D vite-vue-md.Setup.In your vite.config.js file:.Import vite-vue-md and add it to the plugins range.In your vue() plugin alternatives, add an include possibility that includes.md data.vite.config.js:.import vue coming from '@vitejs/ plugin-vue'.+ import vueMd from 'vite-vue-md'.export default plugins: [// ...vue( + include: [/. vue$/,/ . md$/]// u2190 Deal with MD data as Vue parts. ),.+ vueMd(/ * Options */)// u2190 Compile MD files to Vue elements.]// ...To assemble a Vue.js codeblock as a Demonstration Block, add demo close to the foreign language name:."' vue trial.
Click me."'( end).Multi-file demos.The access goal for trial blocks should be a Vue.js element. However you may import various other code blocks in any sort of language coming from the exact same Fall report.For non-entry data, set a report title using trial=. Then bring in it from the Vue.js demonstration block by means of the doctor: process:.
Click me.
Second data:.trial= click-handler. js.export const clickHandler = () => sharp(' Clicked on!').Demonstration + Code obstructs.Since the code blocks are actually made inline, they're changed by the true Vue.js part. To show the code block, you may add a onDemo callback to the plugin alternatives:.( onDemo( componentTag, code) // Register the wrapper component.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Return a personalized HTML strand.gain '.$ componentTag
$ this.escapeHtml( code)'. ).Options.feature.Kind: ReadonlyArray|chain|RegExp.Data to consist of from being collected as Vue data.exclude.Style: ReadonlyArray|chain|RegExp.Data to exclude from being put together as Vue files.markdownItOptions.Type: markdownIt.Options.MarkdownIt options. See MarkdownIt's paperwork to read more.markdownItSetup.Kind: (md: markdownIt) => space.Callback to include plugins to MarkdownIt.wrapperClass.Style: string.Default: markdown-body.The training class to add to the cover factor which contains the Accounting allowance web page.onDemo.Type:.(.tag: cord,.code: string,.demos: Map.) => string.You can obstruct each trial block and return a personalized HTML strand. This works for adding personalized designing to demonstration blocks.Moreover, there are utils subjected in the this context:.escapeHtml: Retreat HTML code to stop it coming from being left as HTML.registerComponent: Register an element to become made use of in the demonstration block. This serves for signing up parts that are imported coming from various other documents.Observe instance over in the Demonstration Blocks section.markdownCss.Style: chain.File pathway to a stylesheet to utilize for the Accounting allowance web page. This will be actually included making use of so it is going to merely apply to the accounting allowance webpage. Practical for designating merely the HTML created by the MarkdownIt plugin.useVOnce.Style: boolean.Whether to incorporate v-once to the whole Markdown web page. This are going to prevent the Accounting allowance page coming from being re-rendered when the Vue element is improved.Warning: This will certainly turn off demonstration blocks. Just utilize this if you have a huge document as well as do not need demo blocks.Related.unplugin-vue-markdown.An additional Vite plugin for putting together Markdown documents to Vue components.This plugin has actually pulled motivation coming from it however possesses a various feature set. This plugin just supports Vue.js code in code blocks.Github.View Github.