.This Vite plugin includes support for importing a Markdown file as a Vue component. Performs along with Vue 2 & 3.Vue.js Demo Blocks.Leave your Vue.js code obstructs inline through just including demonstration alongside the language title.For example, when this Accounting allowance data is actually left using this plugin, you'll observe a clickable switch here:."' vue trial.
Click me."'( end).Install.npm install -D vite-vue-md.Setup.In your vite.config.js file:.Bring in vite-vue-md and include it to the plugins collection.In your vue() plugin options, add a consist of choice that includes.md files.vite.config.js:.bring in vue coming from '@vitejs/ plugin-vue'.+ import vueMd from 'vite-vue-md'.export default plugins: [// ...vue( + consist of: [/. vue$/,/ . md$/]// u2190 Deal with MD documents as Vue elements. ),.+ vueMd(/ * Options */)// u2190 Put together MD files to Vue parts.]// ...To assemble a Vue.js codeblock as a Trial Block, include demo beside the language name:."' vue trial.
Click me."'( end).Multi-file demonstrations.The access aim for demo blocks have to be actually a Vue.js component. Yet you can import other code blocks in any type of foreign language from the exact same Accounting allowance documents.For non-entry files, placed a report label via demonstration=. After that import it from the Vue.js trial block using the doctor: procedure:.
Click me.
Second data:.trial= click-handler. js.export const clickHandler = () => alert(' Clicked!').Trial + Code shuts out.Given that the code blocks are actually made inline, they're replaced by the genuine Vue.js part. To reveal the code block, you may incorporate a onDemo callback to the plugin options:.( onDemo( componentTag, code) // Register the wrapper part.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Return a personalized HTML cord.return '.$ componentTag
$ this.escapeHtml( code)'. ).Alternatives.consist of.Style: ReadonlyArray|chain|RegExp.Reports to consist of coming from being organized as Vue reports.leave out.Type: ReadonlyArray|string|RegExp.Documents to leave out from being actually put together as Vue reports.markdownItOptions.Kind: markdownIt.Options.MarkdownIt choices. See MarkdownIt's records for additional information.markdownItSetup.Kind: (md: markdownIt) => void.Callback to incorporate plugins to MarkdownIt.wrapperClass.Type: cord.Nonpayment: markdown-body.The course to include in the cover element which contains the Markdown page.onDemo.Style:.(.tag: cord,.code: string,.trials: Map.) => string.You may obstruct each demonstration block and also come back a custom-made HTML cord. This serves for adding custom styling to demonstration blocks.Additionally, there are utils left open in the this situation:.escapeHtml: Retreat HTML code to avoid it from being left as HTML.registerComponent: Register a part to be utilized in the demonstration block. This works for enrolling elements that are imported from other documents.Observe instance over in the Trial Blocks segment.markdownCss.Style: string.Submit road to a stylesheet to make use of for the Fall page. This will certainly be included using so it is going to merely apply to the markdown webpage. Useful for styling just the HTML created by the MarkdownIt plugin.useVOnce.Style: boolean.Whether to incorporate v-once to the whole Markdown web page. This will certainly protect against the Fall web page coming from being actually re-rendered when the Vue part is actually upgraded.Warning: This will disable demo blocks. Just use this if you possess a big record as well as don't need trial blocks.Connected.unplugin-vue-markdown.An additional Vite plugin for compiling Fall data to Vue elements.This plugin has pulled creativity from it but possesses a various feature collection. This plugin just sustains Vue.js code in code blocks.Github.View Github.