Skip to content

Commit 1ceb03b

Browse files
committed
Merge branch 'develop' into v5-build-overhaul
# Conflicts: # package-lock.json # package.json
2 parents 40029c4 + 8ef9a3c commit 1ceb03b

File tree

9 files changed

+5149
-7366
lines changed

9 files changed

+5149
-7366
lines changed

docs/configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ window.$docsify = {
956956

957957
- Type: `Object`
958958

959-
Creates and registers global [Vue components](https://vuejs.org/v2/guide/components.html). Components are specified using the component name as the key with an object containing Vue options as the value. Component `data` is unique for each instance and will not persist as users navigate the site.
959+
Creates and registers global [Vue](https://vuejs.org/guide/essentials/component-basics.html). Components are specified using the component name as the key with an object containing Vue options as the value. Component `data` is unique for each instance and will not persist as users navigate the site.
960960

961961
```js
962962
window.$docsify = {
@@ -989,7 +989,7 @@ window.$docsify = {
989989

990990
- Type: `Object`
991991

992-
Specifies [Vue options](https://vuejs.org/v2/api/#Options-Data) for use with Vue content not explicitly mounted with [vueMounts](#mounting-dom-elements), [vueComponents](#components), or a [markdown script](#markdown-script). Changes to global `data` will persist and be reflected anywhere global references are used.
992+
Specifies global Vue options for use with Vue content not explicitly mounted with [vueMounts](#mounting-dom-elements), [vueComponents](#components), or a [markdown script](#markdown-script). Changes to global `data` will persist and be reflected anywhere global references are used.
993993

994994
```js
995995
window.$docsify = {
@@ -1023,7 +1023,7 @@ window.$docsify = {
10231023

10241024
- Type: `Object`
10251025

1026-
Specifies DOM elements to mount as [Vue instances](https://vuejs.org/v2/guide/instance.html) and their associated options. Mount elements are specified using a [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) as the key with an object containing Vue options as their value. Docsify will mount the first matching element in the main content area each time a new page is loaded. Mount element `data` is unique for each instance and will not persist as users navigate the site.
1026+
Specifies DOM elements to mount as Vue instances and their associated options. Mount elements are specified using a [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) as the key with an object containing Vue options as their value. Docsify will mount the first matching element in the main content area each time a new page is loaded. Mount element `data` is unique for each instance and will not persist as users navigate the site.
10271027

10281028
```js
10291029
window.$docsify = {

docs/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,13 @@
224224
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-markdown.min.js"></script>
225225
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-nginx.min.js"></script>
226226
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-php.min.js"></script>
227-
<script src="//cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>
228-
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script> -->
227+
228+
<!-- Vue: Development -->
229+
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.global.js"></script> -->
230+
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.runtime.global.js"></script> -->
231+
232+
<!-- Vue: Production -->
233+
<script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script>
234+
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.runtime.global.prod.js"></script> -->
229235
</body>
230236
</html>

docs/vue.md

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
# Vue compatibility
22

3-
Docsify allows Vue content to be added directly to your markdown pages. This can greatly simplify working with data and adding reactivity to your site.
3+
Docsify allows [Vue.js](https://vuejs.org) content to be added directly to your markdown pages. This can greatly simplify working with data and adding reactivity to your site.
44

5-
To get started, add Vue [2.x](https://vuejs.org) or [3.x](https://v3.vuejs.org) to your `index.html` file. Choose the production version for your live site or the development version for helpful console warnings and [Vue.js devtools](https://github.com/vuejs/vue-devtools) support.
5+
Vue [template syntax](https://vuejs.org/guide/essentials/template-syntax) can be used to add dynamic content to your pages. Vue content becomes more interesting when [data](#data), [computed properties](#computed-properties), [methods](#methods), and [lifecycle hooks](#lifecycle-hooks) are used. These options can be specified as [global options](#global-options) or within DOM [mounts](#mounts) and [components](#components).
66

7-
#### Vue 2.x
7+
## Setup
88

9-
```html
10-
<!-- Production -->
11-
<script src="//cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>
12-
13-
<!-- Development -->
14-
<script src="//cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
15-
```
16-
17-
#### Vue 3.x
9+
To get started, add Vue.js to your `index.html` file. Choose the production version for your live site or the development version for helpful console warnings and [Vue.js devtools](https://github.com/vuejs/vue-devtools) support.
1810

1911
```html
2012
<!-- Production -->
@@ -26,7 +18,7 @@ To get started, add Vue [2.x](https://vuejs.org) or [3.x](https://v3.vuejs.org)
2618

2719
## Template syntax
2820

29-
Vue [template syntax](https://vuejs.org/v2/guide/syntax.html) is used to create dynamic content. With no additional configuration, this syntax offers several useful features like support for [JavaScript expressions](https://vuejs.org/v2/guide/syntax.html#Using-JavaScript-Expressions) and Vue [directives](https://vuejs.org/v2/guide/syntax.html#Directives) for loops and conditional rendering.
21+
Vue [template syntax](https://vuejs.org/guide/essentials/template-syntax) offers several useful features like support for [JavaScript expressions](https://vuejs.org/guide/essentials/template-syntax.html#using-javascript-expressions) and Vue [directives](https://vuejs.org/guide/essentials/template-syntax.html#directives) for loops and conditional rendering.
3022

3123
```markdown
3224
<!-- Hide in docsify, show elsewhere (e.g. GitHub) -->
@@ -53,9 +45,29 @@ Vue [template syntax](https://vuejs.org/v2/guide/syntax.html) is used to create
5345

5446
[View output on GitHub](https://github.com/docsifyjs/docsify/blob/develop/docs/vue.md#template-syntax)
5547

56-
Vue content becomes more interesting when [data](#data), [computed properties](#computed-properties), [methods](#methods), and [lifecycle hooks](#lifecycle-hooks) are used. These options can be specified as [global options](#global-options) or within DOM [mounts](#mounts) and [components](#components).
48+
## Code Blocks
5749

58-
### Data
50+
Docsify ignores Vue template syntax within code blocks by default:
51+
52+
````markdown
53+
```
54+
{{ message}}
55+
```
56+
````
57+
58+
To process Vue template syntax within a code block, wrap the code block in an element with a `v-template` attribute:
59+
60+
````markdown
61+
<div v-template>
62+
63+
```
64+
{{ message}}
65+
```
66+
67+
</div>
68+
````
69+
70+
## Data
5971

6072
```js
6173
{
@@ -74,23 +86,18 @@ Vue content becomes more interesting when [data](#data), [computed properties](#
7486

7587
<!-- Show message in docsify, hide elsewhere (e.g. GitHub) -->
7688
<p v-text="message"></p>
77-
78-
<!-- Show message in docsify, show text elsewhere (e.g. GitHub) -->
79-
<p v-text="message">Text for GitHub</p>
8089
```
8190
<!-- prettier-ignore-end -->
8291

8392
<output data-lang="output">
84-
85-
{{ message }}
93+
<p>{{ message }}</p>
8694

8795
<p v-text="message"></p>
88-
<p v-text="message">Text for GitHub</p>
8996
</output>
9097

9198
[View output on GitHub](https://github.com/docsifyjs/docsify/blob/develop/docs/vue.md#data)
9299

93-
### Computed properties
100+
## Computed properties
94101

95102
```js
96103
{
@@ -123,7 +130,7 @@ Good {{ timeOfDay }}!
123130

124131
</output>
125132

126-
### Methods
133+
## Methods
127134

128135
```js
129136
{
@@ -148,7 +155,7 @@ Good {{ timeOfDay }}!
148155
<p><button @click="hello">Say Hello</button></p>
149156
</output>
150157

151-
### Lifecycle Hooks
158+
## Lifecycle Hooks
152159

153160
```js
154161
{
@@ -193,7 +200,7 @@ Good {{ timeOfDay }}!
193200

194201
## Global options
195202

196-
Use `vueGlobalOptions` to specify [Vue options](https://vuejs.org/v2/api/#Options-Data) for use with Vue content not explicitly mounted with [vueMounts](#mounts), [vueComponents](#components), or a [markdown script](#markdown-script). Changes to global `data` will persist and be reflected anywhere global references are used.
203+
Use `vueGlobalOptions` to specify global Vue options for use with Vue content not explicitly mounted with [vueMounts](#mounts), [vueComponents](#components), or a [markdown script](#markdown-script). Changes to global `data` will persist and be reflected anywhere global references are used.
197204

198205
```js
199206
window.$docsify = {
@@ -209,35 +216,35 @@ window.$docsify = {
209216

210217
```markdown
211218
<p>
212-
<button @click="count -= 1">-</button>
213-
{{ count }}
214219
<button @click="count += 1">+</button>
220+
{{ count }}
221+
<button @click="count -= 1">-</button>
215222
</p>
216223
```
217224

218225
<output data-lang="output">
219226
<p>
220-
<button @click="count -= 1">-</button>
221-
{{ count }}
222227
<button @click="count += 1">+</button>
228+
{{ count }}
229+
<button @click="count -= 1">-</button>
223230
</p>
224231
</output>
225232

226233
Notice the behavior when multiple global counters are rendered:
227234

228235
<output data-lang="output">
229236
<p>
230-
<button @click="count -= 1">-</button>
231-
{{ count }}
232237
<button @click="count += 1">+</button>
238+
{{ count }}
239+
<button @click="count -= 1">-</button>
233240
</p>
234241
</output>
235242

236243
Changes made to one counter affect the both counters. This is because both instances reference the same global `count` value. Now, navigate to a new page and return to this section to see how changes made to global data persist between page loads.
237244

238245
## Mounts
239246

240-
Use `vueMounts` to specify DOM elements to mount as [Vue instances](https://vuejs.org/v2/guide/instance.html) and their associated options. Mount elements are specified using a [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) as the key with an object containing Vue options as their value. Docsify will mount the first matching element in the main content area each time a new page is loaded. Mount element `data` is unique for each instance and will not persist as users navigate the site.
247+
Use `vueMounts` to specify DOM elements to mount as Vue instances and their associated options. Mount elements are specified using a [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) as the key with an object containing Vue options as their value. Docsify will mount the first matching element in the main content area each time a new page is loaded. Mount element `data` is unique for each instance and will not persist as users navigate the site.
241248

242249
```js
243250
window.$docsify = {
@@ -255,21 +262,21 @@ window.$docsify = {
255262

256263
```markdown
257264
<div id="counter">
258-
<button @click="count -= 1">-</button>
259-
{{ count }}
260265
<button @click="count += 1">+</button>
266+
{{ count }}
267+
<button @click="count -= 1">-</button>
261268
</div>
262269
```
263270

264271
<output id="counter">
265-
<button @click="count -= 1">-</button>
266-
{{ count }}
267272
<button @click="count += 1">+</button>
273+
{{ count }}
274+
<button @click="count -= 1">-</button>
268275
</output>
269276

270277
## Components
271278

272-
Use `vueComponents` to create and register global [Vue components](https://vuejs.org/v2/guide/components.html). Components are specified using the component name as the key with an object containing Vue options as the value. Component `data` is unique for each instance and will not persist as users navigate the site.
279+
Use `vueComponents` to create and register global [Vue components](https://vuejs.org/guide/essentials/component-basics.html). Components are specified using the component name as the key with an object containing Vue options as the value. Component `data` is unique for each instance and will not persist as users navigate the site.
273280

274281
```js
275282
window.$docsify = {
@@ -307,17 +314,6 @@ Vue content can mounted using a `<script>` tag in your markdown pages.
307314
!> Only the first `<script>` tag in a markdown file is executed. If you wish to mount multiple Vue instances using a script tag, all instances must be mounted within the first script tag in your markdown.
308315

309316
```html
310-
<!-- Vue 2.x -->
311-
<script>
312-
new Vue({
313-
el: '#example',
314-
// Options...
315-
});
316-
</script>
317-
```
318-
319-
```html
320-
<!-- Vue 3.x -->
321317
<script>
322318
Vue.createApp({
323319
// Options...

0 commit comments

Comments
 (0)