All Projects โ†’ BuptStEve โ†’ vuepress-plugin-demo-code

BuptStEve / vuepress-plugin-demo-code

Licence: MIT license
๐Ÿ“ Demo and code plugin for vuepress

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to vuepress-plugin-demo-code

vuepress-plugin-run
vuepress ๅœจ็บฟ่ฟ่กŒ Vue ๅ•ๆ–‡ไปถ
Stars: โœญ 28 (-76.47%)
Mutual labels:  vuepress, vuepress-plugin
vuepress-plugin-feed
RSS, Atom, and JSON feeds generator plugin for VuePress 1.x
Stars: โœญ 46 (-61.34%)
Mutual labels:  vuepress, vuepress-plugin
vuepress-plugin-svg-icons
๐Ÿ”ฅ SVG sprite plugin for VuePress
Stars: โœญ 17 (-85.71%)
Mutual labels:  vuepress, vuepress-plugin
vuepress-creator
A lightweight creator for VuePress project.
Stars: โœญ 23 (-80.67%)
Mutual labels:  vuepress, vuepress-plugin
vuepress-plugin-autometa
Auto meta tags plugin for VuePress 1.x
Stars: โœญ 40 (-66.39%)
Mutual labels:  vuepress, vuepress-plugin
vuepress-pass
VuePress authentication plugin
Stars: โœญ 13 (-89.08%)
Mutual labels:  vuepress, vuepress-plugin
JavaCertification
This is a full resource guide for my attempt to get Java 11 Certified
Stars: โœญ 67 (-43.7%)
Mutual labels:  code
MicroPython-Samples
๐Ÿ“š Provide many interesting MicroPython Code.
Stars: โœญ 51 (-57.14%)
Mutual labels:  code
PyTools
โค๏ธโค๏ธโค๏ธ Cute Tools By Python
Stars: โœญ 51 (-57.14%)
Mutual labels:  code
awesome-nuxt
๐ŸŽ‰ A curated list of awesome things related to Nuxt.js
Stars: โœญ 17 (-85.71%)
Mutual labels:  vuepress
awesome-course
Create awesome courses that let your audience learn by coding โŒจ๏ธ
Stars: โœญ 224 (+88.24%)
Mutual labels:  code
HacktoberFest21
A beginner friendly repository for HacktoberFest 2021
Stars: โœญ 45 (-62.18%)
Mutual labels:  code
cs
command line codespelunker or code search
Stars: โœญ 34 (-71.43%)
Mutual labels:  code
zksync-docs
zkSync documentation
Stars: โœญ 52 (-56.3%)
Mutual labels:  vuepress
OneDayOneAlgo
Learn one algorithm each day, code it, and upload
Stars: โœญ 27 (-77.31%)
Mutual labels:  code
vuepress-theme-cool
A custom vuepress theme with mermaid and plantuml, katex and vue components.
Stars: โœญ 57 (-52.1%)
Mutual labels:  vuepress
blog
luna-blog
Stars: โœญ 26 (-78.15%)
Mutual labels:  vuepress
code summarization public
source code for 'Improving automatic source code summarization via deep reinforcement learning'
Stars: โœญ 71 (-40.34%)
Mutual labels:  code
js-confuser
JS-Confuser is a JavaScript obfuscation tool to make your programs *impossible* to read.
Stars: โœญ 38 (-68.07%)
Mutual labels:  code
eaf-linter
๐Ÿคช A linter, prettier, and test suite that does everything as-simple-as-possible.
Stars: โœญ 17 (-85.71%)
Mutual labels:  code

vuepress-plugin-demo-code

Downloads per month Version Next Version License

English | ็ฎ€ไฝ“ไธญๆ–‡

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

Please click here to see the demo

Features

  • Only one source code
  • Foldable code
  • Support online editing
    • โœ” Codepen
    • โœ” JSFiddle
    • โœ” CodeSandbox
  • Designed for long code
    • Sticky fold button
    • Auto scroll to top when you fold code

Install

$ npm i -D vuepress-plugin-demo-code
# OR
$ pnpm i -D vuepress-plugin-demo-code
# OR
$ yarn add -D vuepress-plugin-demo-code
  • If you are using vuepress 2.x, please install the next version.
$ npm i -D vuepress-plugin-demo-code@next
# OR
$ pnpm i -D vuepress-plugin-demo-code@next
# OR
$ yarn add -D vuepress-plugin-demo-code@next

Usage

Write vuepress config

module.exports = {
  plugins: ['demo-code'],
}

Options

This plugin supports the following configurations.

module.exports = {
  plugins: [
    ['demo-code', {
      jsLibs: [
        // umd
        'https://unpkg.com/tua-storage/dist/TuaStorage.umd.js',
      ],
      cssLibs: [
        'https://unpkg.com/[email protected]/animate.min.css',
      ],
      vueVersion: '^3',
      showText: 'show code',
      hideText: 'hide',
      styleStr: 'text-decoration: underline;',
      minHeight: 200,
      onlineBtns: {
        codepen: true,
        jsfiddle: true,
        codesandbox: true,
      },
      jsfiddle: {
        framework: 'library/pure', // default
        // framework: 'vue/2.6.11',
      },
      codesandbox: {
        deps: { 'lodash': 'latest' },
        json: '',
        query: '',
        embed: '',
      },
      demoCodeMark: 'demo-code',
      copyOptions: { ... },
    }]
  ],
}

jsLibs

  • Type: Array
  • Default: []

Js libraries for the demo.

cssLibs

  • Type: Array
  • Default: []

Css libraries for the demo.

vueVersion

  • Type: String (semantic versioning syntax)
  • Default: ^2.6.14

The semantic version string of vue. For more information on semantic versioning syntax, see the npm semver calculator.

showText

  • Type: String
  • Default: show code

The display text of unfold code button.

hideText

  • Type: String
  • Default: hide code

The display text of fold code button.

minHeight

  • Type: Number
  • Default: 200(px)

The height of the code when it is folded.

onlineBtns

  • Type: Object
  • Default: { codepen: true, jsfiddle: true, codesandbox: true }

Display online edit buttons.

jsfiddle

  • Type: Object
  • Default: { framework: 'library/pure' }

It passes jsfiddle options.

codesandbox

  • Type: Object
  • Default: { deps: {}, json: '', query: 'module=App.vue'', embed: '' }

It passes CodeSandbox options.

deps is dependencies

demoCodeMark

  • Type: String
  • Default: demo

The mark of the plugin, follows the tag after :::.

copyOptions

  • Type: Object/Boolean
  • Default: { align: 'top', selector: '.demo-and-code-wrapper div[class*="language-"] pre' }

It passes vuepress-plugin-code-copy's options, or false to disable it.

Related

License

MIT

Copyright (c) StEve Young

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


StEve Young

๐Ÿ’ป ๐Ÿ“– ๐Ÿš‡ ๐ŸŒ

leandrofngl

๐Ÿ›

Tian Jian

๐Ÿ›

Spence

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].