Sleep

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

.This Vite plugin includes support for importing a Markdown data as a Vue element. Performs with Vue 2 &amp 3.Vue.js Demo Blocks.Render your Vue.js code shuts out inline by merely including trial close to the language label.As an example, when this Fall documents is actually rendered using this plugin, you'll view a clickable switch below:."' vue trial.
Click me."'( end).Put in.npm set up -D vite-vue-md.Create.In your vite.config.js data:.Bring in vite-vue-md and add it to the plugins collection.In your vue() plugin alternatives, include an include alternative that includes.md data.vite.config.js:.import vue from '@vitejs/ plugin-vue'.+ import vueMd from 'vite-vue-md'.export nonpayment plugins: [// ...vue( + consist of: [/. vue$/,/ . md$/]// u2190 Alleviate MD data as Vue elements. ),.+ vueMd(/ * Options */)// u2190 Compile MD documents to Vue components.]// ...To collect a Vue.js codeblock as a Demonstration Block, incorporate demo beside the foreign language name:."' vue demonstration.
Click me."'( end).Multi-file trials.The entry objective for trial blocks must be a Vue.js element. But you can easily import other code shuts out in any foreign language coming from the very same Markdown documents.For non-entry files, set a report label via demo=. At that point import it coming from the Vue.js trial block via the doctor: method:.
Click me.
Second data:.demonstration= click-handler. js.export const clickHandler = () =&gt sharp(' Clicked!').Trial + Code blocks out.Since the code blocks are actually provided inline, they are actually changed by the actual Vue.js component. To show the code block, you may include a onDemo callback to the plugin choices:.( onDemo( componentTag, code) // Register the wrapper part.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Return a custom HTML cord.gain '.$ componentTag
$ this.escapeHtml( code)'. ).Alternatives.feature.Type: ReadonlyArray|chain|RegExp.Reports to feature coming from being actually put together as Vue reports.leave out.Style: ReadonlyArray|string|RegExp.Data to exclude from being actually collected as Vue documents.markdownItOptions.Style: markdownIt.Options.MarkdownIt choices. Visit MarkdownIt's information to read more.markdownItSetup.Kind: (md: markdownIt) =&gt space.Callback to add plugins to MarkdownIt.wrapperClass.Style: string.Default: markdown-body.The lesson to include in the cover aspect that contains the Fall page.onDemo.Style:.(.tag: strand,.code: strand,.demos: Map.) =&gt strand.You may intercept each demonstration block and also come back a custom-made HTML strand. This is useful for incorporating customized designing to demonstration blocks.On top of that, there are actually utils left open in the this context:.escapeHtml: Escape HTML code to avoid it coming from being actually left as HTML.registerComponent: Sign up a part to become utilized in the trial block. This is useful for enrolling parts that are imported coming from other files.Find example above in the Trial Blocks area.markdownCss.Type: chain.File road to a stylesheet to utilize for the Markdown web page. This will definitely be included using so it will merely relate to the markdown page. Helpful for designating just the HTML generated due to the MarkdownIt plugin.useVOnce.Type: boolean.Whether to add v-once to the entire Markdown web page. This will certainly avoid the Accounting allowance webpage from being re-rendered when the Vue component is actually improved.Caution: This will disable demo blocks. Just use this if you possess a huge paper as well as don't need trial blocks.Connected.unplugin-vue-markdown.An additional Vite plugin for compiling Fall documents to Vue components.This plugin has pulled motivation coming from it but possesses a various component set. This plugin only assists Vue.js code in code blocks.Github.Scenery Github.