Skip to content

Commit 94f7fbf

Browse files
authored
Merge branch 'docsifyjs:develop' into develop
2 parents d9ebafd + 898e6ee commit 94f7fbf

File tree

14 files changed

+81
-100
lines changed

14 files changed

+81
-100
lines changed

Diff for: .github/workflows/test.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ jobs:
2626
- name: Lint
2727
run: npm run lint
2828

29-
- name: Install dependencies [server-renderer]
30-
working-directory: ./packages/docsify-server-renderer
31-
run: npm ci --ignore-scripts
32-
- name: Build [server-renderer]
29+
- name: Verify dependencies [server-renderer]
3330
working-directory: ./packages/docsify-server-renderer
3431
run: npm ci --ignore-scripts
3532

Diff for: docs/configuration.md

+9-21
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,6 @@ window.$docsify = {
153153
};
154154
```
155155

156-
## crossOriginLinks
157-
158-
- Type: `Array`
159-
160-
When `routerMode: 'history'`, you may face cross-origin issues. See [#1379](https://github.com/docsifyjs/docsify/issues/1379).
161-
In Markdown content, there is a simple way to solve it: see extends Markdown syntax `Cross-Origin link` in [helpers](helpers.md).
162-
163-
```js
164-
window.$docsify = {
165-
crossOriginLinks: ['https://example.com/cross-origin-link'],
166-
};
167-
```
168-
169156
## el
170157

171158
- Type: `String`
@@ -701,6 +688,7 @@ window.$docsify = {
701688
Define "virtual" routes that can provide content dynamically. A route is a map between the expected path, to either a string or a function. If the mapped value is a string, it is treated as markdown and parsed accordingly. If it is a function, it is expected to return markdown content.
702689

703690
A route function receives up to three parameters:
691+
704692
1. `route` - the path of the route that was requested (e.g. `/bar/baz`)
705693
2. `matched` - the [`RegExpMatchArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) that was matched by the route (e.g. for `/bar/(.+)`, you get `['/bar/baz', 'baz']`)
706694
3. `next` - this is a callback that you may call when your route function is async
@@ -714,23 +702,23 @@ window.$docsify = {
714702
'/foo': '# Custom Markdown',
715703

716704
// RegEx match w/ synchronous function
717-
'/bar/(.*)': function(route, matched) {
705+
'/bar/(.*)': function (route, matched) {
718706
return '# Custom Markdown';
719707
},
720708

721709
// RegEx match w/ asynchronous function
722-
'/baz/(.*)': function(route, matched, next) {
723-
// Requires `fetch` polyfill for legacy browsers (https://github.github.io/fetch/)
710+
'/baz/(.*)': function (route, matched, next) {
711+
// Requires `fetch` polyfill for legacy browsers (https://github.github.io/fetch/)
724712
fetch('/api/users?id=12345')
725-
.then(function(response) {
713+
.then(function (response) {
726714
next('# Custom Markdown');
727715
})
728-
.catch(function(err) {
716+
.catch(function (err) {
729717
// Handle error...
730718
});
731-
}
732-
}
733-
}
719+
},
720+
},
721+
};
734722
```
735723

736724
Other than strings, route functions can return a falsy value (`null` \ `undefined`) to indicate that they ignore the current request:

Diff for: docs/helpers.md

-8
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set th
6565
[link](/demo ':disabled')
6666
```
6767

68-
## Cross-Origin link
69-
70-
Only when you set both the `routerMode: 'history'` and `externalLinkTarget: '_self'`, you need to add this configuration for those Cross-Origin links.
71-
72-
```md
73-
[example.com](https://example.com/ ':crossorgin')
74-
```
75-
7668
## GitHub Task Lists
7769

7870
```md

Diff for: docs/index.html

+6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
title="pure"
4242
disabled
4343
/>
44+
<link
45+
rel="stylesheet"
46+
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/dolphin.css"
47+
title="dolphin"
48+
disabled
49+
/>
4450
<style>
4551
nav.app-nav li ul {
4652
min-width: 100px;

Diff for: docs/more-pages.md

+2
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,5 @@ This header won't appear in the sidebar table of contents.
135135
```
136136

137137
Both `<!-- {docsify-ignore} -->` and `<!-- {docsify-ignore-all} -->` will not be rendered on the page when used.
138+
139+
And the `{docsify-ignore}` and `{docsify-ignore-all}` can do the samething as well.

Diff for: docs/themes.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ There is a handful of themes available, both official and community-made. Copy [
88
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/buble.css" />
99
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/dark.css" />
1010
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/pure.css" />
11+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/dolphin.css" />
1112
```
1213
<!-- prettier-ignore-end -->
1314

@@ -21,6 +22,7 @@ There is a handful of themes available, both official and community-made. Copy [
2122
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/buble.css" />
2223
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/dark.css" />
2324
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/pure.css" />
25+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/dolphin.css" />
2426
```
2527
<!-- prettier-ignore-end -->
2628

@@ -33,6 +35,7 @@ If you have any ideas or would like to develop a new theme, you are welcome to s
3335
<a data-theme="buble">buble.css</a>
3436
<a data-theme="dark">dark.css</a>
3537
<a data-theme="pure">pure.css</a>
38+
<a data-theme="dolphin">dolphin.css</a>
3639
</div>
3740

3841
<style>

Diff for: index.html

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled />
1010
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled />
1111
<link rel="stylesheet" href="/themes/pure.css" title="pure" disabled />
12+
<link rel="stylesheet" href="/themes/dolphin.css" title="dolphin" disabled />
1213
<style>
1314
nav.app-nav li ul {
1415
min-width: 100px;

Diff for: package-lock.json

+46-37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/docsify-server-renderer/package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/docsify-server-renderer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"dependencies": {
1818
"debug": "^4.3.4",
1919
"docsify": "^4.13.0",
20-
"node-fetch": "^2.6.6",
20+
"node-fetch": "^2.6.9",
2121
"resolve-pathname": "^3.0.0"
2222
}
2323
}

Diff for: src/core/config.js

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default function (vm) {
1313
catchPluginErrors: true,
1414
cornerExternalLinkTarget: '_blank',
1515
coverpage: '',
16-
crossOriginLinks: [],
1716
el: '#app',
1817
executeScript: null,
1918
ext: '.md',

Diff for: src/core/render/compiler/link.js

-11
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@ export const linkCompiler = ({
4343
);
4444
}
4545

46-
// special case to check crossorigin urls
47-
if (
48-
config.crossorgin &&
49-
linkTarget === '_self' &&
50-
compilerClass.config.routerMode === 'history'
51-
) {
52-
if (compilerClass.config.crossOriginLinks.indexOf(href) === -1) {
53-
compilerClass.config.crossOriginLinks.push(href);
54-
}
55-
}
56-
5746
if (config.disabled) {
5847
attrs.push('disabled');
5948
href = 'javascript:void(0)';

Diff for: src/core/router/history/hash.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { noop } from '../../util/core';
1+
import { isExternal, noop } from '../../util/core';
22
import { on } from '../../util/dom';
33
import { endsWith } from '../../util/str';
44
import { parseQuery, cleanPath, replaceSlug } from '../util';
@@ -48,7 +48,7 @@ export class HashHistory extends History {
4848
on('click', e => {
4949
const el = e.target.tagName === 'A' ? e.target : e.target.parentNode;
5050

51-
if (el && el.tagName === 'A' && !/_blank/.test(el.target)) {
51+
if (el && el.tagName === 'A' && !isExternal(el.href)) {
5252
navigating = true;
5353
}
5454
});

0 commit comments

Comments
 (0)