Skip to content

Commit 8c48c06

Browse files
authored
Merge branch 'develop' into patch-1
2 parents 18b6fce + 78aaa37 commit 8c48c06

File tree

32 files changed

+10717
-12313
lines changed

32 files changed

+10717
-12313
lines changed

.eslintrc.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ module.exports = {
4141
'no-shadow': [
4242
'error',
4343
{
44-
allow: ['Events', 'Fetch', 'Lifecycle', 'Render', 'Router'],
44+
allow: [
45+
'Events',
46+
'Fetch',
47+
'Lifecycle',
48+
'Render',
49+
'Router',
50+
'VirtualRoutes',
51+
],
4552
},
4653
],
4754
'no-unused-vars': ['error', { args: 'none' }],

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# [4.13.0](https://github.com/docsifyjs/docsify/compare/v4.12.4...v4.13.0) (2022-10-26)
2+
3+
4+
### Bug Fixes
5+
6+
* cornerExternalLinkTarget config. ([#1814](https://github.com/docsifyjs/docsify/issues/1814)) ([54cc5f9](https://github.com/docsifyjs/docsify/commit/54cc5f939b9499ae56604f589eef4e3f1c13cdc5))
7+
* correctly fix missing +1, -1 ([#1722](https://github.com/docsifyjs/docsify/issues/1722)) ([719dcbe](https://github.com/docsifyjs/docsify/commit/719dcbea5cb0c8b0835f8e9fc473b094feecb7ec))
8+
* Coverpage when content > viewport height ([#1744](https://github.com/docsifyjs/docsify/issues/1744)) ([301b516](https://github.com/docsifyjs/docsify/commit/301b5169613e95765eda335a4b21d0f9f9cbbbfd)), closes [#381](https://github.com/docsifyjs/docsify/issues/381)
9+
* filter null node first. ([#1909](https://github.com/docsifyjs/docsify/issues/1909)) ([d27af3d](https://github.com/docsifyjs/docsify/commit/d27af3dd09a882fce4f1e2774065de57a3501858))
10+
* fix docsify-ignore in seach title. ([#1872](https://github.com/docsifyjs/docsify/issues/1872)) ([9832805](https://github.com/docsifyjs/docsify/commit/9832805681cc6099e9c78deecf6dc0c6fb61fd9b))
11+
* fix search with no content. ([#1878](https://github.com/docsifyjs/docsify/issues/1878)) ([9b74744](https://github.com/docsifyjs/docsify/commit/9b74744299ece0108573a142e5a2e949dc569254))
12+
* Ignore emoji shorthand codes in URIs ([#1847](https://github.com/docsifyjs/docsify/issues/1847)) ([3c9b3d9](https://github.com/docsifyjs/docsify/commit/3c9b3d9702bb05a5ff45a4ce4233e144cf1ebecb)), closes [#1823](https://github.com/docsifyjs/docsify/issues/1823)
13+
* Legacy bugs (styles, site plugin error, and dev server error) ([#1743](https://github.com/docsifyjs/docsify/issues/1743)) ([fa6df6d](https://github.com/docsifyjs/docsify/commit/fa6df6d58487ec294e22be04ac159dfb5745bd66))
14+
* package.json & package-lock.json to reduce vulnerabilities ([#1756](https://github.com/docsifyjs/docsify/issues/1756)) ([2dc5b12](https://github.com/docsifyjs/docsify/commit/2dc5b12b715e3ad1922a6401e3fd9837a99ef9c0))
15+
* packages/docsify-server-renderer/package.json & packages/docsify-server-renderer/package-lock.json to reduce vulnerabilities ([#1715](https://github.com/docsifyjs/docsify/issues/1715)) ([c1227b2](https://github.com/docsifyjs/docsify/commit/c1227b22cb8a3fb6c362ca8ac109082ab2251cc3))
16+
17+
18+
### Features
19+
20+
* Emoji build ([#1766](https://github.com/docsifyjs/docsify/issues/1766)) ([ba5ee26](https://github.com/docsifyjs/docsify/commit/ba5ee26f00e957b58173f96b1901f6ffd3d8e5f5))
21+
* Native emoji w/ image-based fallbacks and improved parsing ([#1746](https://github.com/docsifyjs/docsify/issues/1746)) ([35002c9](https://github.com/docsifyjs/docsify/commit/35002c92b762f0d12e51582d7de7914fa380596a)), closes [#779](https://github.com/docsifyjs/docsify/issues/779)
22+
* Plugin error handling ([#1742](https://github.com/docsifyjs/docsify/issues/1742)) ([63b2535](https://github.com/docsifyjs/docsify/commit/63b2535a45a98945ec897277f4fbddec2ddba887))
23+
24+
25+
126
## [4.12.2](https://github.com/docsifyjs/docsify/compare/v4.12.1...v4.12.2) (2022-01-06)
227

328

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase)
7070

7171
### Online one-click setup for Contributing
7272

73-
You can use Gitpod(A free online VS Code-like IDE) for contributing. With single click it'll launch a workspace and automatically:
73+
You can use Gitpod (a free online VS Code-like IDE) for contributing. With a single click it'll launch a workspace and automatically:
7474

7575
- clone the docsify repo.
7676
- install the dependencies.

docs/_coverpage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![logo](_media/icon.svg)
22

3-
# docsify <small>4.12.2</small>
3+
# docsify <small>4.13.0</small>
44

55
> A magical documentation site generator.
66

docs/_navbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- Translations
22
- [:uk: English](/)
3-
- [:cn: 中文](/zh-cn/)
3+
- [:cn: 简体中文](/zh-cn/)
44
- [:de: Deutsch](/de-de/)
55
- [:es: Español](/es/)
66
- [:ru: Русский](/ru-ru/)

docs/configuration.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The config can also be defined as a function, in which case the first argument i
3535
- Type: `Object`
3636

3737
Set the route alias. You can freely manage routing rules. Supports RegExp.
38+
Do note that order matters! If a route can be matched by multiple aliases, the one you declared first takes precedence.
3839

3940
```js
4041
window.$docsify = {
@@ -680,6 +681,91 @@ window.$docsify = {
680681
};
681682
```
682683

684+
## routes
685+
686+
- Type: `Object`
687+
688+
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.
689+
690+
A route function receives up to three parameters:
691+
1. `route` - the path of the route that was requested (e.g. `/bar/baz`)
692+
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']`)
693+
3. `next` - this is a callback that you may call when your route function is async
694+
695+
Do note that order matters! Routes are matched the same order you declare them in, which means that in cases where you have overlapping routes, you might want to list the more specific ones first.
696+
697+
```js
698+
window.$docsify = {
699+
routes: {
700+
// Basic match w/ return string
701+
'/foo': '# Custom Markdown',
702+
703+
// RegEx match w/ synchronous function
704+
'/bar/(.*)': function(route, matched) {
705+
return '# Custom Markdown';
706+
},
707+
708+
// RegEx match w/ asynchronous function
709+
'/baz/(.*)': function(route, matched, next) {
710+
// Requires `fetch` polyfill for legacy browsers (https://github.github.io/fetch/)
711+
fetch('/api/users?id=12345')
712+
.then(function(response) {
713+
next('# Custom Markdown');
714+
})
715+
.catch(function(err) {
716+
// Handle error...
717+
});
718+
}
719+
}
720+
}
721+
```
722+
723+
Other than strings, route functions can return a falsy value (`null` \ `undefined`) to indicate that they ignore the current request:
724+
725+
```js
726+
window.$docsify = {
727+
routes: {
728+
// accepts everything other than dogs (synchronous)
729+
'/pets/(.+)': function(route, matched) {
730+
if (matched[0] === 'dogs') {
731+
return null;
732+
} else {
733+
return 'I like all pets but dogs';
734+
}
735+
}
736+
737+
// accepts everything other than cats (asynchronous)
738+
'/pets/(.*)': function(route, matched, next) {
739+
if (matched[0] === 'cats') {
740+
next();
741+
} else {
742+
// Async task(s)...
743+
next('I like all pets but cats');
744+
}
745+
}
746+
}
747+
}
748+
```
749+
750+
Finally, if you have a specific path that has a real markdown file (and therefore should not be matched by your route), you can opt it out by returning an explicit `false` value:
751+
752+
```js
753+
window.$docsify = {
754+
routes: {
755+
// if you look up /pets/cats, docsify will skip all routes and look for "pets/cats.md"
756+
'/pets/cats': function(route, matched) {
757+
return false;
758+
}
759+
760+
// but any other pet should generate dynamic content right here
761+
'/pets/(.+)': function(route, matched) {
762+
const pet = matched[0];
763+
return `your pet is ${pet} (but not a cat)`;
764+
}
765+
}
766+
}
767+
```
768+
683769
## subMaxLevel
684770

685771
- Type: `Number`

docs/custom-navbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If you need custom navigation, you can create a HTML-based navigation bar.
1212
<body>
1313
<nav>
1414
<a href="#/">EN</a>
15-
<a href="#/zh-cn/">中文</a>
15+
<a href="#/zh-cn/">简体中文</a>
1616
</nav>
1717
<div id="app"></div>
1818
</body>

docs/deploy.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pa
77
There are three places to populate your docs for your GitHub repository:
88

99
- `docs/` folder
10-
- master branch
10+
- main branch
1111
- gh-pages branch
1212

13-
It is recommended that you save your files to the `./docs` subfolder of the `master` branch of your repository. Then select `master branch /docs folder` as your GitHub Pages source in your repository's settings page.
13+
It is recommended that you save your files to the `./docs` subfolder of the `main` branch of your repository. Then select `main branch /docs folder` as your GitHub Pages source in your repository's settings page.
1414

1515
![GitHub Pages](_images/deploy-github-pages.png)
1616

17-
!> You can also save files in the root directory and select `master branch`.
17+
!> You can also save files in the root directory and select `main branch`.
1818
You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch)
1919

2020
## GitLab Pages

docs/write-a-plugin.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ window.$docsify = {
2222
Alternatively, a plugin can be stored in a separate file and "installed" using a standard `<script>` tag:
2323

2424
```js
25+
// docsify-plugin-myplugin.js
26+
2527
(function () {
2628
var myPlugin = function (hook, vm) {
2729
// ...
2830
};
2931

3032
// Add plugin to docsify's plugin array
3133
$docsify = $docsify || {};
32-
$docsify.plugins = [].concat(myPlugin, $docsify.plugins || []);
34+
$docsify.plugins = [].concat($docsify.plugins || [], myPlugin);
3335
})();
3436
```
3537

0 commit comments

Comments
 (0)