Sleep

Vite- Vue-MD: Import.md data as Vue.js Elements

.This Vite plugin incorporates help for importing a Fall documents as a Vue part. Performs with Vue 2 &amp 3.Vue.js Demonstration Blocks.Render your Vue.js code blocks out inline through merely including trial next to the language title.For instance, when this Fall documents is actually left using this plugin, you'll find a clickable switch here:."' vue demo.
Click me."'( end).Install.npm mount -D vite-vue-md.Create.In your vite.config.js file:.Bring in vite-vue-md and also incorporate it to the plugins array.In your vue() plugin options, incorporate a feature option that includes.md files.vite.config.js:.import vue coming from '@vitejs/ plugin-vue'.+ import vueMd coming from 'vite-vue-md'.export nonpayment plugins: [// ...vue( + include: [/. vue$/,/ . md$/]// u2190 Treat MD documents as Vue parts. ),.+ vueMd(/ * Options */)// u2190 Assemble MD documents to Vue parts.]// ...To organize a Vue.js codeblock as a Demonstration Block, add demonstration next to the language label:."' vue demonstration.
Click me."'( end).Multi-file demos.The admittance aim for demo blocks need to be actually a Vue.js element. But you can easily import various other code blocks in any kind of language from the same Fall documents.For non-entry files, set a file title through trial=. At that point bring in it coming from the Vue.js demonstration block via the doctor: protocol:.
Click me.
2nd file:.demo= click-handler. js.export const clickHandler = () =&gt alert(' Clicked on!').Demo + Code shuts out.Given that the code blocks are provided inline, they're switched out due to the genuine Vue.js component. To present the code block, you can easily include a onDemo callback to the plugin options:.( onDemo( componentTag, code) // Register the cover part.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Return a custom HTML string.profit '.$ componentTag
$ this.escapeHtml( code)'. ).Options.include.Style: ReadonlyArray|string|RegExp.Data to include coming from being actually assembled as Vue data.exclude.Style: ReadonlyArray|chain|RegExp.Documents to leave out from being organized as Vue data.markdownItOptions.Style: markdownIt.Options.MarkdownIt options. Go to MarkdownIt's documentation to read more.markdownItSetup.Kind: (md: markdownIt) =&gt void.Callback to add plugins to MarkdownIt.wrapperClass.Style: strand.Nonpayment: markdown-body.The training class to include in the wrapper aspect that contains the Fall web page.onDemo.Type:.(.tag: cord,.code: strand,.trials: Map.) =&gt cord.You may obstruct each demo block and come back a custom-made HTML strand. This works for incorporating personalized designing to demonstration blocks.Moreover, there are actually utils revealed in the this context:.escapeHtml: Escape HTML code to avoid it from being actually provided as HTML.registerComponent: Register a component to be used in the trial block. This serves for signing up components that are actually imported coming from other documents.Observe example over in the Demo Blocks part.markdownCss.Style: chain.Submit pathway to a stylesheet to utilize for the Fall page. This will definitely be included utilizing so it is going to simply put on the markdown page. Useful for styling just the HTML created due to the MarkdownIt plugin.useVOnce.Style: boolean.Whether to include v-once to the whole entire Accounting allowance page. This are going to protect against the Fall page coming from being actually re-rendered when the Vue part is upgraded.Caution: This will definitely disable demonstration blocks. Just utilize this if you have a huge document and also don't need to have trial blocks.Connected.unplugin-vue-markdown.Another Vite plugin for putting together Fall reports to Vue parts.This plugin has pulled inspiration coming from it however has a various feature collection. This plugin merely assists Vue.js code in code blocks.Github.Sight Github.