.This Vite plugin includes support for importing an Accounting allowance documents as a Vue component. Performs along with Vue 2 & 3.Vue.js Trial Blocks.Make your Vue.js code blocks inline through simply adding demonstration beside the language name.For instance, when this Fall report is actually left through this plugin, you'll view a clickable button listed below:."' vue demo.
Click me."'( end).Mount.npm put in -D vite-vue-md.Setup.In your vite.config.js file:.Import vite-vue-md and also incorporate it to the plugins selection.In your vue() plugin possibilities, add a feature alternative that includes.md files.vite.config.js:.import vue from '@vitejs/ plugin-vue'.+ bring in vueMd from 'vite-vue-md'.export default plugins: [// ...vue( + include: [/. vue$/,/ . md$/]// u2190 Handle MD reports as Vue parts. ),.+ vueMd(/ * Options */)// u2190 Collect MD documents to Vue elements.]// ...To compile a Vue.js codeblock as a Trial Block, incorporate demonstration next to the language name:."' vue trial.
Click me."'( end).Multi-file demonstrations.The entry aim for trial blocks have to be actually a Vue.js component. But you may import other code blocks out in any sort of foreign language coming from the same Fall file.For non-entry data, placed a report title using demonstration=. After that import it from the Vue.js demo block using the doctor: method:.
Click me.
Second report:.demonstration= click-handler. js.export const clickHandler = () => alert(' Clicked!').Demo + Code blocks out.Because the code blocks are rendered inline, they are actually changed by the real Vue.js element. To reveal the code block, you may incorporate a onDemo callback to the plugin choices:.( onDemo( componentTag, code) // Sign up the wrapper element.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Profits a personalized HTML cord.profit '.$ componentTag
$ this.escapeHtml( code)'. ).Choices.include.Kind: ReadonlyArray|chain|RegExp.Files to feature from being actually compiled as Vue reports.omit.Type: ReadonlyArray|string|RegExp.Data to leave out coming from being actually compiled as Vue documents.markdownItOptions.Style: markdownIt.Options.MarkdownIt possibilities. Check out MarkdownIt's paperwork to read more.markdownItSetup.Type: (md: markdownIt) => space.Callback to include plugins to MarkdownIt.wrapperClass.Style: strand.Default: markdown-body.The class to contribute to the wrapper component which contains the Fall page.onDemo.Style:.(.tag: string,.code: string,.trials: Map.) => string.You can easily intercept each demo block as well as return a custom HTML string. This is useful for including custom-made styling to trial blocks.On top of that, there are actually utils exposed in the this circumstance:.escapeHtml: Escape HTML code to prevent it from being actually made as HTML.registerComponent: Sign up a part to be used in the demonstration block. This is useful for registering elements that are actually imported from various other files.Find example over in the Trial Blocks segment.markdownCss.Style: string.File pathway to a stylesheet to utilize for the Fall webpage. This will definitely be actually included making use of so it is going to simply relate to the accounting allowance page. Beneficial for designating only the HTML produced due to the MarkdownIt plugin.useVOnce.Kind: boolean.Whether to incorporate v-once to the whole entire Fall page. This will certainly avoid the Fall web page coming from being re-rendered when the Vue element is updated.Alert: This will certainly disable trial blocks. Merely use this if you have a big file and don't need demo blocks.Associated.unplugin-vue-markdown.An additional Vite plugin for compiling Fall files to Vue components.This plugin has actually pulled inspiration from it but possesses a various feature collection. This plugin only supports Vue.js code in code blocks.Github.View Github.