.This Vite plugin includes assistance for importing a Markdown data as a Vue component. Works along with Vue 2 & 3.Vue.js Demonstration Blocks.Render your Vue.js code blocks inline by just including demonstration close to the foreign language name.As an example, when this Accounting allowance report is actually made with this plugin, you'll see a clickable button here:."' vue trial.
Click me."'( end).Install.npm mount -D vite-vue-md.Setup.In your vite.config.js data:.Import vite-vue-md and also add it to the plugins range.In your vue() plugin possibilities, include an include possibility that includes.md reports.vite.config.js:.import vue coming from '@vitejs/ plugin-vue'.+ bring in vueMd coming from 'vite-vue-md'.export default plugins: [// ...vue( + include: [/. vue$/,/ . md$/]// u2190 Alleviate MD reports as Vue components. ),.+ vueMd(/ * Options */)// u2190 Collect MD reports to Vue components.]// ...To assemble a Vue.js codeblock as a Trial Block, add trial next to the foreign language title:."' vue trial.
Click me."'( end).Multi-file demos.The access aim for demonstration blocks should be actually a Vue.js element. But you may import various other code shuts out in any type of foreign language coming from the same Accounting allowance data.For non-entry files, established a report name by means of trial=. After that import it coming from the Vue.js demonstration block by means of the doc: procedure:.
Click me.
Second report:.demo= click-handler. js.export const clickHandler = () => sharp(' Clicked on!').Trial + Code shuts out.Due to the fact that the code blocks are made inline, they are actually changed due to the genuine Vue.js part. To show the code block, you can incorporate a onDemo callback to the plugin choices:.( onDemo( componentTag, code) // Register the wrapper element.this.registerComponent(' DemoContainer', './ DemoContainer.vue').// Profits a custom-made HTML strand.return '.$ componentTag
$ this.escapeHtml( code)'. ).Possibilities.consist of.Style: ReadonlyArray|chain|RegExp.Data to consist of from being actually organized as Vue reports.omit.Type: ReadonlyArray|string|RegExp.Data to leave out coming from being actually put together as Vue reports.markdownItOptions.Style: markdownIt.Options.MarkdownIt choices. Go to MarkdownIt's paperwork for more details.markdownItSetup.Style: (md: markdownIt) => void.Callback to incorporate plugins to MarkdownIt.wrapperClass.Kind: cord.Default: markdown-body.The training class to contribute to the wrapper element which contains the Fall web page.onDemo.Style:.(.tag: cord,.code: cord,.demonstrations: Map.) => cord.You can obstruct each demo block and also return a custom-made HTML cord. This works for incorporating personalized styling to demonstration blocks.Moreover, there are actually utils left open in the this circumstance:.escapeHtml: Escape HTML code to prevent it from being made as HTML.registerComponent: Sign up a part to become utilized in the demonstration block. This is useful for registering parts that are imported coming from other files.Observe instance above in the Demonstration Blocks segment.markdownCss.Type: chain.Submit road to a stylesheet to make use of for the Markdown web page. This will certainly be added using so it will just put on the accounting allowance web page. Beneficial for styling simply the HTML generated by the MarkdownIt plugin.useVOnce.Style: boolean.Whether to add v-once to the whole Fall page. This are going to protect against the Markdown page coming from being re-rendered when the Vue part is actually upgraded.Caution: This will certainly disable demonstration blocks. Just utilize this if you possess a huge paper as well as don't need to have demo blocks.Connected.unplugin-vue-markdown.One more Vite plugin for organizing Markdown data to Vue components.This plugin has actually drawn inspiration from it yet has a different function set. This plugin only supports Vue.js code in code blocks.Github.Scenery Github.