Sleep

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

.This Vite plugin adds assistance for importing a Markdown report as a Vue component. Performs along with Vue 2 &amp 3.Vue.js Demo Blocks.Provide your Vue.js code blocks inline through just adding demo alongside the foreign language label.As an example, when this Accounting allowance documents is made through this plugin, you'll view a clickable button here:."' vue demo.
Click me."'( end).Put up.npm put up -D vite-vue-md.Create.In your vite.config.js data:.Bring in vite-vue-md as well as include it to the plugins variety.In your vue() plugin choices, add a consist of possibility that includes.md data.vite.config.js:.import vue coming from '@vitejs/ plugin-vue'.+ import vueMd from 'vite-vue-md'.export nonpayment plugins: [// ...vue( + feature: [/. vue$/,/ . md$/]// u2190 Address MD reports as Vue elements. ),.+ vueMd(/ * Options */)// u2190 Compile MD files to Vue elements.]// ...To assemble a Vue.js codeblock as a Demonstration Block, include demonstration alongside the language label:."' vue trial.
Click me."'( end).Multi-file demonstrations.The admittance aim for trial blocks should be actually a Vue.js element. However you can easily import various other code obstructs in any sort of foreign language from the same Markdown report.For non-entry data, set a report name via trial=. After that import it coming from the Vue.js demo block using the doctor: method:.
Click me.
Second data:.demonstration= click-handler. js.export const clickHandler = () =&gt sharp(' Clicked!').Demo + Code blocks out.Since the code blocks are actually provided inline, they're substituted by the real Vue.js element. To present the code block, you can easily incorporate a onDemo callback to the plugin options:.( onDemo( componentTag, code) // Register the wrapper component.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Profits a customized HTML strand.gain '.$ componentTag
$ this.escapeHtml( code)'. ).Choices.consist of.Kind: ReadonlyArray|string|RegExp.Data to consist of from being actually compiled as Vue documents.omit.Kind: ReadonlyArray|chain|RegExp.Data to omit from being organized as Vue documents.markdownItOptions.Type: markdownIt.Options.MarkdownIt possibilities. See MarkdownIt's records to read more.markdownItSetup.Kind: (md: markdownIt) =&gt void.Callback to incorporate plugins to MarkdownIt.wrapperClass.Type: string.Nonpayment: markdown-body.The class to include in the wrapper aspect which contains the Accounting allowance webpage.onDemo.Kind:.(.tag: strand,.code: string,.trials: Chart.) =&gt strand.You can easily intercept each demo block and come back a customized HTML strand. This serves for adding customized styling to demo blocks.Moreover, there are utils subjected in the this situation:.escapeHtml: Retreat HTML code to prevent it coming from being left as HTML.registerComponent: Register an element to be utilized in the demonstration block. This works for registering parts that are imported from other reports.View example above in the Trial Blocks section.markdownCss.Style: chain.File pathway to a stylesheet to utilize for the Markdown webpage. This are going to be actually included using so it will just relate to the fall page. Helpful for styling simply the HTML created by the MarkdownIt plugin.useVOnce.Type: boolean.Whether to include v-once to the entire Accounting allowance webpage. This will stop the Accounting allowance page coming from being actually re-rendered when the Vue element is updated.Warning: This will certainly turn off demonstration blocks. Only utilize this if you have a huge record as well as don't need demo blocks.Associated.unplugin-vue-markdown.An additional Vite plugin for organizing Accounting allowance documents to Vue parts.This plugin has attracted ideas from it yet has a various component collection. This plugin only supports Vue.js code in code blocks.Github.View Github.