-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent people from importing Docsify without versions in URLs. #1733
Open
trusktr
wants to merge
3
commits into
develop
Choose a base branch
from
pin-script-versions
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,53 @@ | ||
# CDN | ||
|
||
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/). | ||
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/). | ||
|
||
## Latest version | ||
## Specific version (RECOMMENDED) | ||
|
||
```html | ||
<!-- load css --> | ||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css"> | ||
<link | ||
rel="stylesheet" | ||
href="//cdn.jsdelivr.net/npm/[email protected]/lib/themes/vue.css" | ||
/> | ||
|
||
<!-- load script --> | ||
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.min.js"></script> | ||
``` | ||
|
||
Alternatively, use [compressed files](#compressed-file). | ||
## Latest version (_NOT_ RECOMMENDED!) | ||
|
||
## Specific version | ||
We highly recommend you do **not** use this method. | ||
|
||
```html | ||
<!-- load css --> | ||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/themes/vue.css"> | ||
|
||
<!-- load script --> | ||
<script src="//cdn.jsdelivr.net/npm/[email protected]/lib/docsify.js"></script> | ||
``` | ||
|
||
## Compressed file | ||
Using the latest version can break your app when docsify is updated due to | ||
breaking changes, either when accidental bugs are introduced, or when a new | ||
major version is realeased with altered features. | ||
|
||
```html | ||
<!-- load css --> | ||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css"> | ||
<link | ||
rel="stylesheet" | ||
href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css" | ||
/> | ||
|
||
<!-- load script --> | ||
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script> | ||
``` | ||
|
||
## Uncompressed files for debugging | ||
|
||
```html | ||
<!-- load css --> | ||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/lib/themes/vue.css"> | ||
<link | ||
rel="stylesheet" | ||
href="//cdn.jsdelivr.net/npm/[email protected]/themes/vue.css" | ||
/> | ||
|
||
<!-- load script --> | ||
<script src="//cdn.jsdelivr.net/npm/docsify@4.10.2/lib/docsify.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.js"></script> | ||
``` | ||
|
||
## Other CDN | ||
## Other CDNs | ||
|
||
- https://www.bootcdn.cn/docsify/ | ||
- https://cdn.jsdelivr.net/npm/docsify/ | ||
|
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
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 |
---|---|---|
|
@@ -20,24 +20,24 @@ | |
/> | ||
<link | ||
rel="stylesheet" | ||
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css" | ||
href="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/themes/vue.css" | ||
title="vue" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/dark.css" | ||
href="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/themes/dark.css" | ||
title="dark" | ||
disabled | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/buble.css" | ||
href="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/themes/buble.css" | ||
title="buble" | ||
disabled | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/pure.css" | ||
href="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/themes/pure.css" | ||
title="pure" | ||
disabled | ||
/> | ||
|
@@ -55,7 +55,7 @@ | |
|
||
<body> | ||
<div id="app">Loading ...</div> | ||
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1/index.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1.0.7/index.js"></script> | ||
<script> | ||
// Set html "lang" attribute based on URL | ||
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//); | ||
|
@@ -118,7 +118,7 @@ | |
'/zh-cn/': '搜索', | ||
'/': 'Search', | ||
}, | ||
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn'] | ||
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn'], | ||
}, | ||
vueComponents: { | ||
'button-counter': { | ||
|
@@ -211,12 +211,12 @@ | |
], | ||
}; | ||
</script> | ||
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-markdown.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-nginx.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-php.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/docsify.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/docsify@4.12.2/lib/plugins/search.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-bash.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-markdown.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-nginx.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@1.26.0/components/prism-php.min.js"></script> | ||
<script> | ||
(function() { | ||
function loadJS(src, attrs) { | ||
|
@@ -227,12 +227,14 @@ | |
|
||
// Public site only | ||
if (/docsify/.test(location.host)) { | ||
loadJS('//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/ga.min.js'); | ||
loadJS('//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/matomo.min.js'); | ||
loadJS('//cdn.jsdelivr.net/npm/[email protected]/lib/plugins/ga.min.js'); | ||
loadJS( | ||
'//cdn.jsdelivr.net/npm/[email protected]/lib/plugins/matomo.min.js' | ||
); | ||
} | ||
})(); | ||
</script> | ||
<script src="//cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script> | ||
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script> --> | ||
<script src="//cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.min.js"></script> | ||
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3.2.29/dist/vue.global.prod.js"></script> --> | ||
</body> | ||
</html> |
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 |
---|---|---|
|
@@ -9,10 +9,10 @@ window.$docsify = { | |
renderer: { | ||
link: function() { | ||
// ... | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` | ||
|
||
?> Configuration Options Reference: [marked documentation](https://marked.js.org/#/USING_ADVANCED.md) | ||
|
@@ -24,17 +24,16 @@ window.$docsify = { | |
markdown: function(marked, renderer) { | ||
// ... | ||
|
||
return marked | ||
} | ||
} | ||
return marked; | ||
}, | ||
}; | ||
``` | ||
|
||
## Supports mermaid | ||
|
||
```js | ||
// Import mermaid | ||
// <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.css"> | ||
// <script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script> | ||
// First include mermaid in your page with: | ||
// <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script> | ||
|
||
var num = 0; | ||
mermaid.initialize({ startOnLoad: false }); | ||
|
@@ -43,14 +42,16 @@ window.$docsify = { | |
markdown: { | ||
renderer: { | ||
code: function(code, lang) { | ||
if (lang === "mermaid") { | ||
if (lang === 'mermaid') { | ||
return ( | ||
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>" | ||
'<div class="mermaid">' + | ||
mermaid.render('mermaid-svg-' + num++, code) + | ||
'</div>' | ||
); | ||
} | ||
return this.origin.code.apply(this, arguments); | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not
@4
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@4
can introduce even accidental breaking changes.The idea is to get even the most beginners to avoid breaking changes and they can update when they want to, but more advanced users will know how to use
@4
and can accept the risk.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @Koooooo-7's idea below, to replace the version automatically, would be great. Let's go with that approach because then it will behave like
@4
for us (for Docsify site), but users will see the full version and will copy/paste that into their projects which is good.