@maiscrm/vuepress-plugin-code-box

0.1.0 • Public • Published

vuepress-plugin-code-gen-box

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>
:::

Features

  • Only one source code
  • Foldable code

Install

$ npm i vuepress-plugin-code-gen-box -D
# OR
$ yarn add vuepress-plugin-code-gen-box -D

Usage

Write vuepress config

module.exports = {
  plugins: ["code-gen-box"],
};

Options

This plugin supports the following configurations.

module.exports = {
  plugins: [
    [
      "demo-code",
      {
        showText: "show code",
        hideText: "hide",
        styleStr: "text-decoration: underline;",
        demoCodeMark: "demo-code",
      },
    ],
  ],
};

showText

  • Type: String
  • Default: 显示代码

The display text of unfold code button.

hideText

  • Type: String
  • Default: 隐藏代码

The display text of fold code button.

License

MIT

Package Sidebar

Install

npm i @maiscrm/vuepress-plugin-code-box

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

9.51 kB

Total Files

7

Last publish

Collaborators

  • maiscrm-sre
  • inetfuture
  • allenli
  • rob.gu
  • zack.sun