@@ -77,15 +77,27 @@ async function docsifyInit(options = {}) {
77
77
loadSidebar : Boolean ( settings . markdown . sidebar ) ,
78
78
} ;
79
79
80
+ const updateBasePath = config => {
81
+ config . basePath = new URL ( config . basePath , TEST_HOST ) . href ;
82
+ } ;
83
+
80
84
// Config as function
81
85
if ( typeof options . config === 'function' ) {
82
86
return function ( vm ) {
83
- return { ...sharedConfig , ...options . config ( vm ) } ;
87
+ const config = { ...sharedConfig , ...options . config ( vm ) } ;
88
+
89
+ updateBasePath ( config ) ;
90
+
91
+ return config ;
84
92
} ;
85
93
}
86
94
// Config as object
87
95
else {
88
- return { ...sharedConfig , ...options . config } ;
96
+ const config = { ...sharedConfig , ...options . config } ;
97
+
98
+ updateBasePath ( config ) ;
99
+
100
+ return config ;
89
101
}
90
102
} ,
91
103
get markdown ( ) {
@@ -101,10 +113,10 @@ async function docsifyInit(options = {}) {
101
113
get routes ( ) {
102
114
const helperRoutes = {
103
115
[ settings . testURL ] : stripIndent `${ settings . html } ` ,
104
- [ '/ README.md' ] : settings . markdown . homepage ,
105
- [ '/ _coverpage.md' ] : settings . markdown . coverpage ,
106
- [ '/ _navbar.md' ] : settings . markdown . navbar ,
107
- [ '/ _sidebar.md' ] : settings . markdown . sidebar ,
116
+ [ 'README.md' ] : settings . markdown . homepage ,
117
+ [ '_coverpage.md' ] : settings . markdown . coverpage ,
118
+ [ '_navbar.md' ] : settings . markdown . navbar ,
119
+ [ '_sidebar.md' ] : settings . markdown . sidebar ,
108
120
} ;
109
121
110
122
const finalRoutes = Object . fromEntries (
@@ -116,7 +128,7 @@ async function docsifyInit(options = {}) {
116
128
. filter ( ( [ url , responseText ] ) => url && responseText )
117
129
. map ( ( [ url , responseText ] ) => [
118
130
// Convert relative to absolute URL
119
- new URL ( url , TEST_HOST ) . href ,
131
+ new URL ( url , settings . config . basePath ) . href ,
120
132
// Strip indentation from responseText
121
133
stripIndent `${ responseText } ` ,
122
134
] )
0 commit comments