-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support online edit with Codepen and JSFiddle and CodeSandbox * ci: only deploy docs in master branch
- Loading branch information
Showing
17 changed files
with
648 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
<a href="https://www.npmjs.com/package/vuepress-plugin-demo-code"><img src="https://img.shields.io/npm/l/vuepress-plugin-demo-code.svg" alt="License"></a> | ||
</p> | ||
|
||
English | [简体中文](README_cn.md) | ||
English | [简体中文](https://buptsteve.github.io/vuepress-plugin-demo-code/zh/) | ||
|
||
> demo-code plugin for vuepress. | ||
|
@@ -28,6 +28,17 @@ export default { | |
|
||
[Please click here to see the demo](https://buptsteve.github.io/vuepress-plugin-demo-code/example/) | ||
|
||
## Features | ||
* Only one source code | ||
* Foldable code | ||
* Online edit support | ||
* ✔ Codepen | ||
* ✔ JSFiddle | ||
* ✔ CodeSandbox | ||
* Designed for long code | ||
* Sticky fold button | ||
* Auto scroll to top when you fold code | ||
|
||
## Install | ||
|
||
* First, install [vuepress v1.x](https://github.com/vuejs/vuepress) | ||
|
@@ -56,16 +67,46 @@ 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', | ||
], | ||
showText: 'show code', | ||
hideText: 'hide', | ||
styleStr: 'text-decoration: underline;', | ||
minHeight: 200, | ||
onlineBtns: { | ||
codepen: true, | ||
jsfiddle: true, | ||
codesandbox: true, | ||
}, | ||
codesandbox: { | ||
deps: { 'lodash': 'latest' }, | ||
json: '', | ||
query: '', | ||
embed: '', | ||
}, | ||
demoCodeMark: 'demo-code', | ||
}] | ||
], | ||
} | ||
``` | ||
|
||
### jsLibs | ||
* Type: `Array` | ||
* Default: `[]` | ||
|
||
Js libraries for the demo. | ||
|
||
### cssLibs | ||
* Type: `Array` | ||
* Default: `[]` | ||
|
||
Css libraries for the demo. | ||
|
||
### showText | ||
* Type: `String` | ||
* Default: `show code` | ||
|
@@ -84,6 +125,20 @@ The display text of fold code button. | |
|
||
The height of the code when it is folded. | ||
|
||
### onlineBtns | ||
* Type: `Object` | ||
* Default: `{ codepen: true, jsfiddle: true, codesandbox: true }` | ||
|
||
Display online edit buttons. | ||
|
||
### codesandbox | ||
* Type: `Object` | ||
* Default: `{ deps: {}, json: '', query: 'module=App.vue'', embed: '' },` | ||
|
||
It passes [CodeSandbox options](https://codesandbox.io/docs/importing#define-api). | ||
|
||
> `deps` is dependencies | ||
### demoCodeMark | ||
* Type: `String` | ||
* Default: `demo` | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,13 @@ module.exports = { | |
}, | ||
head: [ | ||
['link', { rel: 'icon', href: `/favicon.ico` }], | ||
['link', { rel: 'stylesheet', href: `https://unpkg.com/[email protected]/animate.min.css` }], | ||
], | ||
plugins: [ | ||
[demoCode, { | ||
cssLibs: [ | ||
'https://unpkg.com/[email protected]/animate.min.css', | ||
], | ||
showText: 'show more', | ||
hideText: 'hide', | ||
minHeight: 200, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,17 @@ export default { | |
|
||
[Please click here to see the demo](./example/) | ||
|
||
## Features | ||
* Only one source code | ||
* Foldable code | ||
* Online edit support | ||
* ✔ Codepen | ||
* ✔ JSFiddle | ||
* ✔ CodeSandbox | ||
* Designed for long code | ||
* Sticky fold button | ||
* Auto scroll to top when you fold code | ||
|
||
## Install | ||
|
||
* First, install [vuepress v1.x](https://github.com/vuejs/vuepress) | ||
|
@@ -56,16 +67,46 @@ 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', | ||
], | ||
showText: 'show code', | ||
hideText: 'hide', | ||
styleStr: 'text-decoration: underline;', | ||
minHeight: 200, | ||
onlineBtns: { | ||
codepen: true, | ||
jsfiddle: true, | ||
codesandbox: true, | ||
}, | ||
codesandbox: { | ||
deps: { 'lodash': 'latest' }, | ||
json: '', | ||
query: '', | ||
embed: '', | ||
}, | ||
demoCodeMark: 'demo-code', | ||
}] | ||
], | ||
} | ||
``` | ||
|
||
### jsLibs | ||
* Type: `Array` | ||
* Default: `[]` | ||
|
||
Js libraries for the demo. | ||
|
||
### cssLibs | ||
* Type: `Array` | ||
* Default: `[]` | ||
|
||
Css libraries for the demo. | ||
|
||
### showText | ||
* Type: `String` | ||
* Default: `show code` | ||
|
@@ -84,6 +125,20 @@ The display text of fold code button. | |
|
||
The height of the code when it is folded. | ||
|
||
### onlineBtns | ||
* Type: `Object` | ||
* Default: `{ codepen: true, jsfiddle: true, codesandbox: true }` | ||
|
||
Display online edit buttons. | ||
|
||
### codesandbox | ||
* Type: `Object` | ||
* Default: `{ deps: {}, json: '', query: 'module=App.vue'', embed: '' },` | ||
|
||
It passes [CodeSandbox options](https://codesandbox.io/docs/importing#define-api). | ||
|
||
> `deps` is dependencies | ||
### demoCodeMark | ||
* Type: `String` | ||
* Default: `demo` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.