vuepress-plugin-live
Version:
Make your markdown code examples come alive
62 lines (48 loc) • 1.21 kB
Markdown
Vuepress-live allows you to make your examples more interactive automatically. For now, just add a `live` after the language in your fenced code samples like this.
```sh
yarn add -D vuepress-plugin-live
```
In `.vuepress/config.js` add `["live"]` to the list of plugins
```js{6,7,8,9,10,11,12}
const path = require("path");
module.exports = {
//...
plugins: [
[
"live",
{
// optional: use layout to customize how the live editor is going to look like
layout: path.resolve(__dirname, "./myCustomLayout.vue")
}
],
[
"@vuepress/register-components",
{
components: [
{
name: "vue-slider",
path: path.resolve(__dirname, "../vue-slider")
}
]
}
]
]
};
```
Absolute path to the layout vue-live is going to use.
> NOTA: the layout should have 2 slots named `preview` and `editor`.
Example layout (simplest):
```vue
<template functional>
<div>
<slot name="preview"></slot>
<slot name="editor"></slot>
</div>
</template>
```