code-gen-box plugin for vuepress.
With this plugin, you can both display demo and code via following syntax.
::: demo
<div @click="onClick">Click me!</div>
<script>
export default {
methods: {
onClick: () => { window.alert(1) },
},
}
</script>
:::
- Only one source code
- Foldable code
-
First of all, install vuepress v1.x
-
Then install the plugin
$ npm i vuepress-plugin-code-gen-box -D
# OR
$ yarn add vuepress-plugin-code-gen-box -D
Write vuepress config
module.exports = {
plugins: ["code-gen-box"],
};
This plugin supports the following configurations.
module.exports = {
plugins: [
[
"demo-code",
{
showText: "show code",
hideText: "hide",
styleStr: "text-decoration: underline;",
demoCodeMark: "demo-code",
},
],
],
};
- Type:
String
- Default:
ๆพ็คบไปฃ็
The display text of unfold code button.
- Type:
String
- Default:
้่ไปฃ็
The display text of fold code button.