Sleep

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

.This Vite plugin incorporates support for importing a Markdown data as a Vue part. Performs with Vue 2 &amp 3.Vue.js Demo Blocks.Make your Vue.js code blocks out inline by merely including demo next to the language title.As an example, when this Fall documents is made using this plugin, you'll find a clickable button below:."' vue demo.
Click me."'( end).Mount.npm put up -D vite-vue-md.Create.In your vite.config.js report:.Bring in vite-vue-md and also add it to the plugins collection.In your vue() plugin choices, include a feature choice that includes.md documents.vite.config.js:.bring in vue coming from '@vitejs/ plugin-vue'.+ bring in vueMd coming from 'vite-vue-md'.export default plugins: [// ...vue( + include: [/. vue$/,/ . md$/]// u2190 Handle MD data as Vue components. ),.+ vueMd(/ * Options */)// u2190 Organize MD reports to Vue parts.]// ...To compile a Vue.js codeblock as a Demo Block, add demo alongside the language label:."' vue demo.
Click me."'( end).Multi-file demonstrations.The access aim for demo blocks have to be a Vue.js element. Yet you may import various other code blocks in any sort of language from the very same Markdown data.For non-entry data, set a report name through demo=. At that point bring in it coming from the Vue.js demonstration block by means of the doctor: method:.
Click me.
2nd file:.trial= click-handler. js.export const clickHandler = () =&gt sharp(' Clicked!').Trial + Code blocks out.Since the code blocks are actually delivered inline, they're substituted by the real Vue.js element. To present the code block, you can include a onDemo callback to the plugin options:.( onDemo( componentTag, code) // Sign up the wrapper part.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Come back a customized HTML cord.profit '.$ componentTag
$ this.escapeHtml( code)'. ).Choices.feature.Type: ReadonlyArray|chain|RegExp.Documents to include coming from being actually collected as Vue data.exclude.Kind: ReadonlyArray|string|RegExp.Files to exclude from being compiled as Vue files.markdownItOptions.Kind: markdownIt.Options.MarkdownIt options. Visit MarkdownIt's documentation to read more.markdownItSetup.Type: (md: markdownIt) =&gt void.Callback to incorporate plugins to MarkdownIt.wrapperClass.Kind: string.Default: markdown-body.The training class to add to the wrapper factor which contains the Fall page.onDemo.Kind:.(.tag: cord,.code: cord,.demos: Map.) =&gt cord.You may obstruct each demo block and return a customized HTML string. This serves for adding customized designing to demo blocks.Additionally, there are actually utils exposed in the this context:.escapeHtml: Escape HTML code to stop it from being rendered as HTML.registerComponent: Register a part to be made use of in the demo block. This works for signing up parts that are imported coming from various other documents.Observe example over in the Demonstration Blocks part.markdownCss.Kind: chain.Submit path to a stylesheet to utilize for the Fall web page. This will certainly be actually incorporated making use of so it is going to just put on the accounting allowance webpage. Beneficial for styling merely the HTML created due to the MarkdownIt plugin.useVOnce.Kind: boolean.Whether to incorporate v-once to the whole Accounting allowance webpage. This will avoid the Fall web page from being re-rendered when the Vue element is updated.Warning: This will turn off demonstration blocks. Only use this if you have a large paper as well as do not require demo blocks.Connected.unplugin-vue-markdown.One more Vite plugin for organizing Fall documents to Vue elements.This plugin has actually pulled ideas from it but has a different attribute collection. This plugin only supports Vue.js code in code blocks.Github.Sight Github.