Sleep

Vite- Vue-MD: Import.md report as Vue.js Parts

.This Vite plugin incorporates support for importing a Markdown data as a Vue component. Performs with Vue 2 &amp 3.Vue.js Trial Blocks.Leave your Vue.js code blocks out inline through merely including demonstration next to the foreign language title.For example, when this Markdown data is actually made with this plugin, you'll find a clickable button right here:."' vue demo.
Click me."'( end).Set up.npm mount -D vite-vue-md.Create.In your vite.config.js report:.Bring in vite-vue-md as well as incorporate it to the plugins variety.In your vue() plugin choices, include a consist of alternative that includes.md data.vite.config.js:.import vue from '@vitejs/ plugin-vue'.+ bring in vueMd from 'vite-vue-md'.export nonpayment plugins: [// ...vue( + feature: [/. vue$/,/ . md$/]// u2190 Address MD reports as Vue parts. ),.+ vueMd(/ * Options */)// u2190 Compile MD files to Vue elements.]// ...To organize a Vue.js codeblock as a Demo Block, include demo alongside the foreign language title:."' vue demonstration.
Click me."'( end).Multi-file demonstrations.The access point for demonstration blocks have to be a Vue.js component. However you may import various other code blocks out in any type of language coming from the same Fall data.For non-entry documents, placed a data label via demo=. Then bring in it from the Vue.js demo block via the doctor: protocol:.
Click me.
2nd data:.demo= click-handler. js.export const clickHandler = () =&gt sharp(' Clicked on!').Demo + Code shuts out.Given that the code blocks are made inline, they're substituted due to the actual Vue.js part. To reveal the code block, you can easily add a onDemo callback to the plugin alternatives:.( onDemo( componentTag, code) // Sign up the wrapper element.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Profits a custom HTML cord.return '.$ componentTag
$ this.escapeHtml( code)'. ).Alternatives.include.Kind: ReadonlyArray|chain|RegExp.Files to consist of coming from being collected as Vue data.leave out.Style: ReadonlyArray|string|RegExp.Data to exclude from being actually compiled as Vue files.markdownItOptions.Kind: markdownIt.Options.MarkdownIt possibilities. Go to MarkdownIt's paperwork to read more.markdownItSetup.Type: (md: markdownIt) =&gt gap.Callback to add plugins to MarkdownIt.wrapperClass.Kind: strand.Nonpayment: markdown-body.The lesson to add to the cover component which contains the Accounting allowance webpage.onDemo.Type:.(.tag: strand,.code: cord,.demos: Chart.) =&gt strand.You may intercept each trial block and come back a customized HTML string. This is useful for including personalized styling to demonstration blocks.Furthermore, there are actually utils subjected in the this circumstance:.escapeHtml: Escape HTML code to stop it coming from being provided as HTML.registerComponent: Sign up a component to become utilized in the demonstration block. This is useful for registering components that are imported coming from other reports.See example over in the Demo Blocks area.markdownCss.Type: chain.Submit course to a stylesheet to make use of for the Markdown webpage. This are going to be actually incorporated using so it is going to only relate to the markdown webpage. Valuable for designating simply the HTML produced by the MarkdownIt plugin.useVOnce.Style: boolean.Whether to add v-once to the whole entire Accounting allowance webpage. This will definitely prevent the Fall page from being actually re-rendered when the Vue component is upgraded.Precaution: This will disable demonstration blocks. Merely utilize this if you have a big document and also don't need trial blocks.Connected.unplugin-vue-markdown.Yet another Vite plugin for compiling Accounting allowance documents to Vue components.This plugin has actually drawn ideas coming from it but possesses a different attribute set. This plugin just supports Vue.js code in code blocks.Github.Sight Github.

Articles You Can Be Interested In