# Introduction
Demo Container V2
is a Vuepress-based
plug-in, which can help you add Vue
examples when writing documents. Its original intention is to reduce the difficulty of adding some related examples when writing component documents.
# How does it work?
The Demo Container V2 uses Vuepress's chainMarkdown, extendMarkdown API to expand its internal markdown object and does the following:
- Based on markdown-it-container, a plug-in that recognizes the following code blocks is built
:::demo xxx
xxx
:::
Wrap code by <demo-block> </demo-block>
component, wait for subsequent reading;
Expand the
markdown.render
method, based on its rendering results, read the sample code annotated bypre-render-demo
and usevue-template-compiler
compile it into a Redner Function and introduce it as a subcomponent of the entire sample page.The sample page code will be processed by
vue-loader
and compiled into the final document
# What is the rendering effect?
The following is an example of a component rendered using the Demo Container plugin
The display effect refers to the implementation of Element UI document component demo-block.vue
Latest Commits
waycowei/vuepress-plugin-demo-container-v2@master
Found the repository is no commit.