.This Vite plugin includes support for importing a Fall documents as a Vue component. Functions with Vue 2 & 3.Vue.js Trial Blocks.Provide your Vue.js code obstructs inline by simply adding demonstration close to the language title.For example, when this Accounting allowance file is left using this plugin, you'll find a clickable button below:."' vue trial.
Click me."'( end).Mount.npm put in -D vite-vue-md.Setup.In your vite.config.js report:.Bring in vite-vue-md and also include it to the plugins collection.In your vue() plugin choices, add a consist of possibility that includes.md data.vite.config.js:.bring in vue from '@vitejs/ plugin-vue'.+ import vueMd from 'vite-vue-md'.export nonpayment plugins: [// ...vue( + feature: [/. vue$/,/ . md$/]// u2190 Deal with MD files as Vue parts. ),.+ vueMd(/ * Options */)// u2190 Compile MD reports to Vue elements.]// ...To assemble a Vue.js codeblock as a Trial Block, include demonstration beside the foreign language name:."' vue demonstration.
Click me."'( end).Multi-file demonstrations.The entry purpose for trial blocks must be a Vue.js component. But you can easily import other code blocks out in any sort of language from the same Accounting allowance data.For non-entry reports, put a report title by means of demonstration=. Then import it from the Vue.js trial block by means of the doctor: protocol:.
Click me.
2nd file:.trial= click-handler. js.export const clickHandler = () => alert(' Clicked on!').Demonstration + Code obstructs.Due to the fact that the code blocks are actually rendered inline, they are actually switched out by the real Vue.js part. To present the code block, you can incorporate a onDemo callback to the plugin choices:.( onDemo( componentTag, code) // Sign up the cover component.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Come back a personalized HTML string.profit '.$ componentTag
$ this.escapeHtml( code)'. ).Choices.feature.Type: ReadonlyArray|string|RegExp.Data to feature from being collected as Vue documents.omit.Kind: ReadonlyArray|string|RegExp.Data to leave out from being compiled as Vue reports.markdownItOptions.Style: markdownIt.Options.MarkdownIt choices. Check out MarkdownIt's information for additional information.markdownItSetup.Style: (md: markdownIt) => gap.Callback to add plugins to MarkdownIt.wrapperClass.Type: strand.Nonpayment: markdown-body.The lesson to include in the cover factor that contains the Accounting allowance web page.onDemo.Type:.(.tag: cord,.code: string,.trials: Map.) => cord.You can intercept each trial block and return a custom HTML cord. This works for incorporating customized styling to demonstration blocks.Moreover, there are actually utils exposed in the this situation:.escapeHtml: Retreat HTML code to avoid it coming from being actually provided as HTML.registerComponent: Sign up an element to be used in the trial block. This serves for signing up parts that are actually imported from various other reports.See example above in the Trial Blocks area.markdownCss.Style: chain.File pathway to a stylesheet to utilize for the Markdown page. This are going to be incorporated using so it is going to only put on the accounting allowance page. Practical for styling simply the HTML generated due to the MarkdownIt plugin.useVOnce.Style: boolean.Whether to add v-once to the whole entire Fall web page. This are going to prevent the Fall page from being actually re-rendered when the Vue part is actually updated.Caution: This will disable trial blocks. Merely use this if you possess a big paper as well as do not require demonstration blocks.Associated.unplugin-vue-markdown.An additional Vite plugin for compiling Fall documents to Vue elements.This plugin has attracted ideas from it but possesses a different attribute set. This plugin simply supports Vue.js code in code blocks.Github.View Github.