Sleep

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

.This Vite plugin includes help for importing a Markdown report as a Vue element. Functions with Vue 2 &amp 3.Vue.js Demonstration Blocks.Leave your Vue.js code shuts out inline through simply incorporating demo close to the language name.For instance, when this Accounting allowance data is actually left using this plugin, you'll see a clickable button right here:."' vue trial.
Click me."'( end).Install.npm mount -D vite-vue-md.Setup.In your vite.config.js data:.Bring in vite-vue-md and incorporate it to the plugins selection.In your vue() plugin choices, include an include choice that includes.md files.vite.config.js:.import vue from '@vitejs/ plugin-vue'.+ import vueMd coming from 'vite-vue-md'.export nonpayment plugins: [// ...vue( + include: [/. vue$/,/ . md$/]// u2190 Treat MD reports as Vue elements. ),.+ vueMd(/ * Options */)// u2190 Assemble MD data to Vue elements.]// ...To collect a Vue.js codeblock as a Trial Block, incorporate demo close to the foreign language name:."' vue trial.
Click me."'( end).Multi-file demos.The entry purpose for demonstration blocks have to be actually a Vue.js element. Yet you can import other code shuts out in any sort of foreign language from the very same Fall data.For non-entry reports, placed a report name by means of demo=. At that point bring in it coming from the Vue.js trial block via the doctor: protocol:.
Click me.
Second data:.demonstration= click-handler. js.export const clickHandler = () =&gt alert(' Clicked!').Demo + Code blocks.Considering that the code blocks are delivered inline, they're replaced by the actual Vue.js element. To show the code block, you can easily add a onDemo callback to the plugin possibilities:.( onDemo( componentTag, code) // Register the cover part.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Come back a custom HTML strand.gain '.$ componentTag
$ this.escapeHtml( code)'. ).Alternatives.feature.Kind: ReadonlyArray|string|RegExp.Documents to feature coming from being compiled as Vue files.omit.Kind: ReadonlyArray|chain|RegExp.Documents to exclude coming from being collected as Vue files.markdownItOptions.Style: markdownIt.Options.MarkdownIt options. See MarkdownIt's records to find out more.markdownItSetup.Style: (md: markdownIt) =&gt void.Callback to add plugins to MarkdownIt.wrapperClass.Type: strand.Default: markdown-body.The class to include in the wrapper aspect which contains the Markdown page.onDemo.Style:.(.tag: string,.code: string,.trials: Chart.) =&gt cord.You may intercept each demo block and come back a customized HTML strand. This is useful for including custom designing to demo blocks.In addition, there are actually utils left open in the this situation:.escapeHtml: Escape HTML code to avoid it from being provided as HTML.registerComponent: Sign up an element to be used in the trial block. This serves for signing up elements that are imported coming from other reports.See instance over in the Demonstration Blocks section.markdownCss.Style: chain.Submit road to a stylesheet to use for the Fall page. This will be added making use of so it will simply apply to the markdown web page. Practical for designating just the HTML produced by the MarkdownIt plugin.useVOnce.Type: boolean.Whether to add v-once to the whole entire Fall webpage. This will prevent the Accounting allowance web page coming from being actually re-rendered when the Vue component is actually upgraded.Precaution: This will certainly turn off demo blocks. Merely utilize this if you have a large file and do not require trial blocks.Connected.unplugin-vue-markdown.One more Vite plugin for compiling Fall data to Vue parts.This plugin has attracted creativity coming from it yet has a various attribute collection. This plugin just supports Vue.js code in code blocks.Github.Viewpoint Github.