.This Vite plugin includes support for importing a Markdown data as a Vue part. Works along with Vue 2 & 3.Vue.js Trial Blocks.Provide your Vue.js code shuts out inline by just including demo alongside the foreign language name.For example, when this Fall data is provided with this plugin, you'll see a clickable button below:."' vue demo.
Click me."'( end).Put up.npm put in -D vite-vue-md.Setup.In your vite.config.js data:.Import vite-vue-md and also include it to the plugins assortment.In your vue() plugin options, add an include option that includes.md documents.vite.config.js:.import vue from '@vitejs/ plugin-vue'.+ import vueMd from 'vite-vue-md'.export default plugins: [// ...vue( + consist of: [/. vue$/,/ . md$/]// u2190 Treat MD documents as Vue components. ),.+ vueMd(/ * Options */)// u2190 Compile MD documents to Vue elements.]// ...To collect a Vue.js codeblock as a Demonstration Block, incorporate demonstration alongside the foreign language title:."' vue demo.
Click me."'( end).Multi-file trials.The access aim for demo blocks must be actually a Vue.js element. Yet you can import other code blocks in any sort of foreign language coming from the same Fall data.For non-entry reports, established a documents name through demonstration=. After that import it from the Vue.js demonstration block via the doc: process:.
Click me.
Second file:.trial= click-handler. js.export const clickHandler = () => sharp(' Clicked!').Demo + Code obstructs.Considering that the code blocks are actually made inline, they are actually replaced by the real Vue.js part. To reveal the code block, you can easily include a onDemo callback to the plugin options:.( onDemo( componentTag, code) // Register the cover element.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Profits a custom HTML cord.return '.$ componentTag
$ this.escapeHtml( code)'. ).Alternatives.include.Type: ReadonlyArray|chain|RegExp.Files to feature coming from being actually collected as Vue documents.leave out.Style: ReadonlyArray|string|RegExp.Documents to leave out coming from being collected as Vue reports.markdownItOptions.Style: markdownIt.Options.MarkdownIt choices. Visit MarkdownIt's information to find out more.markdownItSetup.Style: (md: markdownIt) => void.Callback to incorporate plugins to MarkdownIt.wrapperClass.Type: cord.Default: markdown-body.The training class to add to the wrapper factor which contains the Markdown page.onDemo.Kind:.(.tag: cord,.code: cord,.demos: Chart.) => strand.You can easily intercept each demo block and also return a custom-made HTML cord. This works for incorporating custom designing to demonstration blocks.Moreover, there are utils subjected in the this situation:.escapeHtml: Retreat HTML code to stop it coming from being rendered as HTML.registerComponent: Sign up a part to be made use of in the trial block. This is useful for signing up elements that are actually imported coming from other data.Find instance over in the Demonstration Blocks section.markdownCss.Type: string.Submit road to a stylesheet to make use of for the Accounting allowance web page. This are going to be included utilizing so it will merely relate to the fall webpage. Useful for designating just the HTML produced by the MarkdownIt plugin.useVOnce.Type: boolean.Whether to add v-once to the entire Fall webpage. This will protect against the Accounting allowance webpage from being re-rendered when the Vue component is upgraded.Warning: This will certainly disable demonstration blocks. Simply utilize this if you possess a large file as well as do not require demonstration blocks.Connected.unplugin-vue-markdown.Another Vite plugin for assembling Fall files to Vue elements.This plugin has pulled ideas from it yet possesses a different function collection. This plugin just assists Vue.js code in code blocks.Github.Viewpoint Github.