Skip to content

Commit 4bd7ac8

Browse files
committed
updated docs per feedback
1 parent 4277cc5 commit 4bd7ac8

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

docs/configuration.md

Lines changed: 3 additions & 22 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 = {
@@ -48,8 +49,6 @@ window.$docsify = {
4849
};
4950
```
5051

51-
Do note that order matters! If a route can be matched by multiple aliases, the one you declared first takes precedence.
52-
5352
## auto2top
5453

5554
- Type: `Boolean`
@@ -693,6 +692,8 @@ A route function receives up to three parameters:
693692
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']`)
694693
3. `next` - this is a callback that you may call when your route function is async
695694

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+
696697
```js
697698
window.$docsify = {
698699
routes: {
@@ -750,26 +751,6 @@ window.$docsify = {
750751
}
751752
```
752753

753-
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:
754-
755-
```js
756-
window.$docsify = {
757-
routes: {
758-
// if you look up /pets/cats, this route is always matched first
759-
'/pets/cats': function(route, matched) {
760-
return 'This is a special page for cats!';
761-
}
762-
763-
// and this route will match every other pet, but never cats, since it is the second route to be declared
764-
'/pets/(.+)': function(route, matched) {
765-
const pet = matched[0];
766-
return `your pet is ${pet} (but not a cat, so it doesn't get its own route!)`;
767-
}
768-
}
769-
}
770-
```
771-
772-
773754
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:
774755

775756
```js

0 commit comments

Comments
 (0)