@@ -58,7 +58,7 @@ const compileMedia = {
58
58
const id = `docsify-get-${ uid ++ } `
59
59
let ext = url . match ( / \. ( \w + ) $ / )
60
60
61
- ext = config . ext || ( ext && ext [ 1 ] )
61
+ ext = config . lang || ( ext && ext [ 1 ] )
62
62
if ( ext === 'md' ) ext = 'markdown'
63
63
64
64
if ( ! process . env . SSR ) {
@@ -182,6 +182,32 @@ export class Compiler {
182
182
const { str, config } = getAndRemoveConfig ( title )
183
183
title = str
184
184
185
+ if ( config . include ) {
186
+ if ( ! isAbsolutePath ( href ) ) {
187
+ href = getPath ( contentBase , href )
188
+ }
189
+
190
+ let media
191
+ if ( config . type && ( media = compileMedia [ config . type ] ) ) {
192
+ return media . call ( _self , href , title )
193
+ }
194
+
195
+ let type = null
196
+ if ( / \. ( m d | m a r k d o w n ) / . test ( href ) ) {
197
+ type = 'markdown'
198
+ } else if ( / \. h t m l ? / . test ( href ) ) {
199
+ type = 'html'
200
+ } else if ( / \. ( m p 4 | o g g ) / . test ( href ) ) {
201
+ type = 'video'
202
+ } else if ( / \. m p 3 / . test ( href ) ) {
203
+ type = 'audio'
204
+ }
205
+ console . log ( href )
206
+ if ( type ) {
207
+ return compileMedia [ type ] . call ( _self , href , title )
208
+ }
209
+ }
210
+
185
211
if (
186
212
! / : | ( \/ { 2 } ) / . test ( href ) &&
187
213
! _self . matchNotCompileLink ( href ) &&
@@ -235,25 +261,6 @@ export class Compiler {
235
261
url = getPath ( contentBase , href )
236
262
}
237
263
238
- let media
239
- if ( config . type && ( media = compileMedia [ config . type ] ) ) {
240
- return media . call ( _self , url , title )
241
- }
242
-
243
- let type = null
244
- if ( / \. ( m d | m a r k d o w n ) / . test ( url ) ) {
245
- type = 'markdown'
246
- } else if ( / \. h t m l ? / . test ( url ) ) {
247
- type = 'html'
248
- } else if ( / \. ( m p 4 | o g g ) / . test ( url ) ) {
249
- type = 'video'
250
- } else if ( / \. m p 3 / . test ( url ) ) {
251
- type = 'audio'
252
- }
253
- if ( type ) {
254
- return compileMedia [ type ] . call ( _self , url , title )
255
- }
256
-
257
264
return `<img src="${ url } "data-origin="${ href } " alt="${ text } "${ attrs } >`
258
265
}
259
266
0 commit comments