Skip to content

Commit 8303386

Browse files
committed
add versions to all CDN link examples to prevent people from making websites that are at risk of breaking changes to Docsify, make it clear that the recommended approach is to use full versions in URLs, and fix formatting in any files that were modified
1 parent e0bead3 commit 8303386

File tree

14 files changed

+291
-230
lines changed

14 files changed

+291
-230
lines changed

docs/cdn.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,53 @@
11
# CDN
22

3-
Recommended: [jsDelivr](//cdn.jsdelivr.net), which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at [cdn.jsdelivr.net/npm/docsify/](//cdn.jsdelivr.net/npm/docsify/).
3+
Recommended: [jsDelivr](//cdn.jsdelivr.net). You can also browse the source of the npm package at [cdn.jsdelivr.net/npm/docsify/](//cdn.jsdelivr.net/npm/docsify/).
44

5-
## Latest version
5+
## Specific version (RECOMMENDED)
66

77
```html
88
<!-- load css -->
9-
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css">
9+
<link
10+
rel="stylesheet"
11+
href="//cdn.jsdelivr.net/npm/[email protected]/lib/themes/vue.css"
12+
/>
1013

1114
<!-- load script -->
12-
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.js"></script>
15+
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.min.js"></script>
1316
```
1417

15-
Alternatively, use [compressed files](#compressed-file).
18+
## Latest version (_NOT_ RECOMMENDED!)
1619

17-
## Specific version
20+
We highly recommend you do **not** use this method.
1821

19-
```html
20-
<!-- load css -->
21-
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/themes/vue.css">
22-
23-
<!-- load script -->
24-
<script src="//cdn.jsdelivr.net/npm/[email protected]/lib/docsify.js"></script>
25-
```
26-
27-
## Compressed file
22+
Using the latest version can break your app when docsify is updated due to
23+
breaking changes, either when accidental bugs are introduced, or when a new
24+
major version is realeased with altered features.
2825

2926
```html
3027
<!-- load css -->
31-
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css">
28+
<link
29+
rel="stylesheet"
30+
href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css"
31+
/>
3232

3333
<!-- load script -->
3434
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
3535
```
3636

37+
## Uncompressed files for debugging
38+
3739
```html
3840
<!-- load css -->
39-
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/lib/themes/vue.css">
41+
<link
42+
rel="stylesheet"
43+
href="//cdn.jsdelivr.net/npm/[email protected]/themes/vue.css"
44+
/>
4045

4146
<!-- load script -->
42-
<script src="//cdn.jsdelivr.net/npm/docsify@4.10.2/lib/docsify.min.js"></script>
47+
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.js"></script>
4348
```
4449

45-
## Other CDN
50+
## Other CDNs
4651

4752
- https://www.bootcdn.cn/docsify/
4853
- https://cdn.jsdelivr.net/npm/docsify/

docs/cover.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
1111

1212
<script>
1313
window.$docsify = {
14-
coverpage: true
15-
}
14+
coverpage: true,
15+
};
1616
</script>
17-
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
17+
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.min.js"></script>
1818
```
1919

2020
```markdown
@@ -81,7 +81,7 @@ Now, you can set
8181

8282
```js
8383
window.$docsify = {
84-
coverpage: ['/', '/zh-cn/']
84+
coverpage: ['/', '/zh-cn/'],
8585
};
8686
```
8787

@@ -91,7 +91,7 @@ Or a special file name
9191
window.$docsify = {
9292
coverpage: {
9393
'/': 'cover.md',
94-
'/zh-cn/': 'cover.md'
95-
}
94+
'/zh-cn/': 'cover.md',
95+
},
9696
};
9797
```

docs/custom-navbar.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ Alternatively, you can create a custom markdown-based navigation file by setting
2727

2828
<script>
2929
window.$docsify = {
30-
loadNavbar: true
31-
}
30+
loadNavbar: true,
31+
};
3232
</script>
33-
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
33+
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.min.js"></script>
3434
```
3535

3636
```markdown
3737
<!-- _navbar.md -->
3838

39-
* [En](/)
40-
* [chinese](/zh-cn/)
39+
- [En](/)
40+
- [chinese](/zh-cn/)
4141
```
4242

4343
!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
@@ -51,19 +51,19 @@ You can create sub-lists by indenting items that are under a certain parent.
5151
```markdown
5252
<!-- _navbar.md -->
5353

54-
* Getting started
54+
- Getting started
5555

56-
* [Quick start](quickstart.md)
57-
* [Writing more pages](more-pages.md)
58-
* [Custom navbar](custom-navbar.md)
59-
* [Cover page](cover.md)
56+
- [Quick start](quickstart.md)
57+
- [Writing more pages](more-pages.md)
58+
- [Custom navbar](custom-navbar.md)
59+
- [Cover page](cover.md)
6060

61-
* Configuration
62-
* [Configuration](configuration.md)
63-
* [Themes](themes.md)
64-
* [Using plugins](plugins.md)
65-
* [Markdown configuration](markdown.md)
66-
* [Language highlight](language-highlight.md)
61+
- Configuration
62+
- [Configuration](configuration.md)
63+
- [Themes](themes.md)
64+
- [Using plugins](plugins.md)
65+
- [Markdown configuration](markdown.md)
66+
- [Language highlight](language-highlight.md)
6767
```
6868

6969
renders as
@@ -80,17 +80,17 @@ If you use the [emoji plugin](plugins#emoji):
8080
<script>
8181
window.$docsify = {
8282
// ...
83-
}
83+
};
8484
</script>
85-
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
86-
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js"></script>
85+
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.min.js"></script>
86+
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/plugins/emoji.min.js"></script>
8787
```
8888

8989
you could, for example, use flag emojis in your custom navbar Markdown file:
9090

9191
```markdown
9292
<!-- _navbar.md -->
9393

94-
* [:us:, :uk:](/)
95-
* [:cn:](/zh-cn/)
94+
- [:us:, :uk:](/)
95+
- [:cn:](/zh-cn/)
9696
```

docs/index.html

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@
2020
/>
2121
<link
2222
rel="stylesheet"
23-
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css"
23+
href="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/themes/vue.css"
2424
title="vue"
2525
/>
2626
<link
2727
rel="stylesheet"
28-
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/dark.css"
28+
href="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/themes/dark.css"
2929
title="dark"
3030
disabled
3131
/>
3232
<link
3333
rel="stylesheet"
34-
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/buble.css"
34+
href="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/themes/buble.css"
3535
title="buble"
3636
disabled
3737
/>
3838
<link
3939
rel="stylesheet"
40-
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/pure.css"
40+
href="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/themes/pure.css"
4141
title="pure"
4242
disabled
4343
/>
@@ -55,7 +55,7 @@
5555

5656
<body>
5757
<div id="app">Loading ...</div>
58-
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1/index.js"></script>
58+
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1.0.7/index.js"></script>
5959
<script>
6060
// Set html "lang" attribute based on URL
6161
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//);
@@ -118,7 +118,7 @@
118118
'/zh-cn/': '搜索',
119119
'/': 'Search',
120120
},
121-
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn']
121+
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn'],
122122
},
123123
vueComponents: {
124124
'button-counter': {
@@ -211,12 +211,12 @@
211211
],
212212
};
213213
</script>
214-
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script>
215-
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script>
216-
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
217-
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-markdown.min.js"></script>
218-
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-nginx.min.js"></script>
219-
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-php.min.js"></script>
214+
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.min.js"></script>
215+
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/plugins/search.min.js"></script>
216+
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-bash.min.js"></script>
217+
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-markdown.min.js"></script>
218+
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-nginx.min.js"></script>
219+
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-php.min.js"></script>
220220
<script>
221221
(function() {
222222
function loadJS(src, attrs) {
@@ -227,12 +227,14 @@
227227

228228
// Public site only
229229
if (/docsify/.test(location.host)) {
230-
loadJS('//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/ga.min.js');
231-
loadJS('//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/matomo.min.js');
230+
loadJS('//cdn.jsdelivr.net/npm/[email protected]/lib/plugins/ga.min.js');
231+
loadJS(
232+
'//cdn.jsdelivr.net/npm/[email protected]/lib/plugins/matomo.min.js'
233+
);
232234
}
233235
})();
234236
</script>
235-
<script src="//cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>
236-
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script> -->
237+
<script src="//cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script>
238+
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3.2.29/dist/vue.global.prod.js"></script> -->
237239
</body>
238240
</html>

docs/language-highlight.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
Docsify uses [Prism](https://prismjs.com) to highlight code blocks in your pages. Prism supports the following languages by default:
44

5-
* Markup - `markup`, `html`, `xml`, `svg`, `mathml`, `ssml`, `atom`, `rss`
6-
* CSS - `css`
7-
* C-like - `clike`
8-
* JavaScript - `javascript`, `js`
5+
- Markup - `markup`, `html`, `xml`, `svg`, `mathml`, `ssml`, `atom`, `rss`
6+
- CSS - `css`
7+
- C-like - `clike`
8+
- JavaScript - `javascript`, `js`
99

1010
Support for [additional languages](https://prismjs.com/#supported-languages) is available by loading the language-specific [grammar files](https://cdn.jsdelivr.net/npm/prismjs@1/components/) via CDN:
1111

1212
```html
13-
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
14-
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-php.min.js"></script>
13+
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-bash.min.js"></script>
14+
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-php.min.js"></script>
1515
```
1616

1717
To enable syntax highlighting, wrap each code block in triple backticks with the [language](https://prismjs.com/#supported-languages) specified on the first line:
@@ -27,7 +27,7 @@ echo "hello"
2727
```
2828
2929
```php
30-
function getAdder(int $x): int
30+
function getAdder(int $x): int
3131
{
3232
return 123;
3333
}
@@ -46,18 +46,19 @@ echo "hello"
4646
```
4747

4848
```php
49-
function getAdder(int $x): int
49+
function getAdder(int $x): int
5050
{
5151
return 123;
5252
}
5353
```
5454

5555
## Highlighting Dynamic Content
56+
5657
Code blocks [dynamically created from javascript](https://docsify.js.org/#/configuration?id=executescript) can be highlighted using the method `Prism.highlightElement` like so:
5758

5859
```javascript
59-
var code = document.createElement("code");
60+
var code = document.createElement('code');
6061
code.innerHTML = "console.log('Hello World!')";
61-
code.setAttribute("class", "lang-javascript");
62+
code.setAttribute('class', 'lang-javascript');
6263
Prism.highlightElement(code);
6364
```

docs/markdown.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ window.$docsify = {
99
renderer: {
1010
link: function() {
1111
// ...
12-
}
13-
}
14-
}
15-
}
12+
},
13+
},
14+
},
15+
};
1616
```
1717

1818
?> Configuration Options Reference: [marked documentation](https://marked.js.org/#/USING_ADVANCED.md)
@@ -24,17 +24,16 @@ window.$docsify = {
2424
markdown: function(marked, renderer) {
2525
// ...
2626

27-
return marked
28-
}
29-
}
27+
return marked;
28+
},
29+
};
3030
```
3131

3232
## Supports mermaid
3333

3434
```js
35-
// Import mermaid
36-
// <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.css">
37-
// <script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
35+
// First include mermaid in your page with:
36+
// <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
3837

3938
var num = 0;
4039
mermaid.initialize({ startOnLoad: false });
@@ -43,14 +42,16 @@ window.$docsify = {
4342
markdown: {
4443
renderer: {
4544
code: function(code, lang) {
46-
if (lang === "mermaid") {
45+
if (lang === 'mermaid') {
4746
return (
48-
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"
47+
'<div class="mermaid">' +
48+
mermaid.render('mermaid-svg-' + num++, code) +
49+
'</div>'
4950
);
5051
}
5152
return this.origin.code.apply(this, arguments);
52-
}
53-
}
54-
}
55-
}
53+
},
54+
},
55+
},
56+
};
5657
```

0 commit comments

Comments
 (0)