File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ export class HashHistory extends History {
18
18
const path = window . location . pathname || '' ;
19
19
const base = this . config . basePath ;
20
20
21
+ // This handles the case where Docsify is served off an
22
+ // explicit file path, i.e.`/base/index.html#/blah`. This
23
+ // prevents the `/index.html` part of the URI from being
24
+ // remove during routing.
25
+ // See here: https://github.com/docsifyjs/docsify/pull/1372
21
26
const basePath = path . endsWith ( '.html' )
22
27
? path + '#/' + base
23
28
: path + '/' + base ;
Original file line number Diff line number Diff line change @@ -76,6 +76,29 @@ export const resolvePath = cached(path => {
76
76
return '/' + resolved . join ( '/' ) ;
77
77
} ) ;
78
78
79
+ /**
80
+ * Normalises the URI path to handle the case where Docsify is
81
+ * hosted off explicit files, i.e. /index.html. This function
82
+ * eliminates any path segments that contain `#` fragments.
83
+ *
84
+ * This is used to map browser URIs to markdown file sources.
85
+ *
86
+ * For example:
87
+ *
88
+ * http://example.org/base/index.html#/blah
89
+ *
90
+ * would be mapped to:
91
+ *
92
+ * http://example.org/base/blah.md.
93
+ *
94
+ * See here for more information:
95
+ *
96
+ * https://github.com/docsifyjs/docsify/pull/1372
97
+ *
98
+ * @param {string } path The URI path to normalise
99
+ * @return {string } { path, query }
100
+ */
101
+
79
102
function normaliseFragment ( path ) {
80
103
return path
81
104
. split ( '/' )
You can’t perform that action at this time.
0 commit comments