Sleep

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

.This Vite plugin includes help for importing a Markdown file as a Vue element. Works with Vue 2 &amp 3.Vue.js Demonstration Blocks.Leave your Vue.js code obstructs inline by just incorporating demo close to the language label.For instance, when this Accounting allowance file is rendered using this plugin, you'll see a clickable switch listed below:."' vue demonstration.
Click me."'( end).Put in.npm install -D vite-vue-md.Create.In your vite.config.js data:.Bring in vite-vue-md and also incorporate it to the plugins collection.In your vue() plugin alternatives, incorporate a consist of choice that includes.md data.vite.config.js:.bring in vue from '@vitejs/ plugin-vue'.+ import vueMd from 'vite-vue-md'.export nonpayment plugins: [// ...vue( + feature: [/. vue$/,/ . md$/]// u2190 Manage MD reports as Vue components. ),.+ vueMd(/ * Options */)// u2190 Compile MD documents to Vue elements.]// ...To assemble a Vue.js codeblock as a Trial Block, add demo next to the foreign language title:."' vue demo.
Click me."'( end).Multi-file demos.The access point for trial blocks need to be a Vue.js element. However you may import various other code blocks out in any kind of foreign language from the very same Accounting allowance documents.For non-entry reports, established a documents label through demonstration=. At that point bring in it coming from the Vue.js demo block by means of the doctor: procedure:.
Click me.
Second file:.demo= click-handler. js.export const clickHandler = () =&gt alert(' Clicked on!').Demo + Code blocks out.Since the code blocks are made inline, they're switched out due to the genuine Vue.js component. To present the code block, you can easily add a onDemo callback to the plugin possibilities:.( onDemo( componentTag, code) // Register the wrapper part.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Profits a custom HTML strand.profit '.$ componentTag
$ this.escapeHtml( code)'. ).Alternatives.feature.Kind: ReadonlyArray|chain|RegExp.Documents to include from being compiled as Vue documents.exclude.Kind: ReadonlyArray|chain|RegExp.Data to omit coming from being assembled as Vue documents.markdownItOptions.Type: markdownIt.Options.MarkdownIt choices. Go to MarkdownIt's records to read more.markdownItSetup.Kind: (md: markdownIt) =&gt void.Callback to incorporate plugins to MarkdownIt.wrapperClass.Type: cord.Nonpayment: markdown-body.The course to include in the wrapper component that contains the Markdown web page.onDemo.Kind:.(.tag: cord,.code: string,.demos: Map.) =&gt strand.You can easily obstruct each demo block and come back a custom HTML cord. This works for incorporating personalized styling to demo blocks.Furthermore, there are actually utils subjected in the this situation:.escapeHtml: Escape HTML code to prevent it coming from being left as HTML.registerComponent: Register a part to become utilized in the trial block. This serves for registering elements that are imported from various other reports.See example over in the Demo Blocks part.markdownCss.Style: chain.Submit path to a stylesheet to use for the Accounting allowance webpage. This will be added making use of so it will only relate to the accounting allowance webpage. Beneficial for styling just the HTML created by the MarkdownIt plugin.useVOnce.Kind: boolean.Whether to incorporate v-once to the whole Fall webpage. This will certainly protect against the Markdown page from being re-rendered when the Vue element is improved.Alert: This will certainly disable demonstration blocks. Simply utilize this if you have a big record and don't need to have demo blocks.Connected.unplugin-vue-markdown.Yet another Vite plugin for putting together Fall files to Vue parts.This plugin has actually drawn ideas coming from it but possesses a different attribute collection. This plugin simply sustains Vue.js code in code blocks.Github.Sight Github.

Articles You Can Be Interested In