You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration.md
+3-22Lines changed: 3 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,7 @@ The config can also be defined as a function, in which case the first argument i
35
35
- Type: `Object`
36
36
37
37
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.
38
39
39
40
```js
40
41
window.$docsify= {
@@ -48,8 +49,6 @@ window.$docsify = {
48
49
};
49
50
```
50
51
51
-
Do note that order matters! If a route can be matched by multiple aliases, the one you declared first takes precedence.
52
-
53
52
## auto2top
54
53
55
54
- Type: `Boolean`
@@ -693,6 +692,8 @@ A route function receives up to three parameters:
693
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']`)
694
693
3.`next` - this is a callback that you may call when your route function is async
695
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
+
696
697
```js
697
698
window.$docsify= {
698
699
routes: {
@@ -750,26 +751,6 @@ window.$docsify = {
750
751
}
751
752
```
752
753
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
-
constpet= 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
-
773
754
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:
0 commit comments