Sleep

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

.This Vite plugin adds assistance for importing a Markdown file as a Vue component. Functions with Vue 2 &amp 3.Vue.js Demonstration Blocks.Provide your Vue.js code blocks inline by just including trial alongside the foreign language name.For instance, when this Markdown documents is left using this plugin, you'll see a clickable button right here:."' vue trial.
Click me."'( end).Put up.npm mount -D vite-vue-md.Create.In your vite.config.js file:.Import vite-vue-md and add it to the plugins variety.In your vue() plugin alternatives, add an include alternative that includes.md documents.vite.config.js:.import vue coming from '@vitejs/ plugin-vue'.+ import vueMd from 'vite-vue-md'.export default plugins: [// ...vue( + include: [/. vue$/,/ . md$/]// u2190 Treat MD data as Vue parts. ),.+ vueMd(/ * Options */)// u2190 Organize MD documents to Vue components.]// ...To organize a Vue.js codeblock as a Trial Block, incorporate demo alongside the foreign language label:."' vue demonstration.
Click me."'( end).Multi-file demos.The entry goal for demonstration blocks have to be actually a Vue.js component. Yet you can import various other code blocks in any sort of foreign language from the same Markdown file.For non-entry files, put a report name through trial=. After that bring in it coming from the Vue.js trial block via the doc: process:.
Click me.
2nd data:.demo= click-handler. js.export const clickHandler = () =&gt sharp(' Clicked!').Trial + Code blocks out.Given that the code blocks are delivered inline, they are actually substituted by the genuine Vue.js element. To reveal the code block, you can include a onDemo callback to the plugin choices:.( onDemo( componentTag, code) // Register the cover component.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Profits a customized HTML string.profit '.$ componentTag
$ this.escapeHtml( code)'. ).Choices.feature.Style: ReadonlyArray|chain|RegExp.Data to feature coming from being actually put together as Vue documents.leave out.Type: ReadonlyArray|chain|RegExp.Files to omit from being collected as Vue reports.markdownItOptions.Kind: markdownIt.Options.MarkdownIt alternatives. See MarkdownIt's paperwork for more information.markdownItSetup.Kind: (md: markdownIt) =&gt space.Callback to incorporate plugins to MarkdownIt.wrapperClass.Type: string.Nonpayment: markdown-body.The lesson to add to the wrapper component that contains the Accounting allowance webpage.onDemo.Kind:.(.tag: string,.code: cord,.trials: Chart.) =&gt cord.You can intercept each trial block and return a customized HTML string. This serves for adding customized styling to demo blocks.Moreover, there are utils subjected in the this context:.escapeHtml: Retreat HTML code to stop it coming from being made as HTML.registerComponent: Sign up a component to become used in the trial block. This works for registering components that are imported coming from various other documents.Find instance above in the Demonstration Blocks segment.markdownCss.Type: string.Submit course to a stylesheet to use for the Fall page. This will be actually included using so it will just apply to the accounting allowance web page. Helpful for styling merely the HTML created due to the MarkdownIt plugin.useVOnce.Type: boolean.Whether to incorporate v-once to the whole entire Fall web page. This will definitely prevent the Markdown web page from being actually re-rendered when the Vue component is updated.Alert: This will turn off demonstration blocks. Simply use this if you possess a huge record and also do not require demonstration blocks.Associated.unplugin-vue-markdown.Yet another Vite plugin for putting together Fall files to Vue elements.This plugin has actually attracted motivation coming from it yet has a various attribute collection. This plugin only supports Vue.js code in code blocks.Github.Viewpoint Github.