@@ -343,7 +343,9 @@ function main(config) {
343
343
'</button>' +
344
344
'<aside class="sidebar">' +
345
345
( config . name ?
346
- ( "<h1><a class=\"app-name-link\" data-nosearch>" + ( config . name ) + "</a></h1>" ) :
346
+ ( "<h1><a class=\"app-name-link\" data-nosearch>" + ( config . logo ?
347
+ ( "<img alt=" + ( config . name ) + " src=" + ( config . logo ) + ">" ) :
348
+ config . name ) + "</a></h1>" ) :
347
349
'' ) +
348
350
'<div class="sidebar-nav"><!--sidebar--></div>' +
349
351
'</aside>' ;
@@ -3120,7 +3122,7 @@ Compiler.prototype._initRenderer = function _initRenderer () {
3120
3122
title = str ;
3121
3123
3122
3124
if (
3123
- ! / : | ( \/ { 2 } ) / . test ( href ) &&
3125
+ ! isAbsolutePath ( href ) &&
3124
3126
! _self . _matchNotCompileLink ( href ) &&
3125
3127
! config . ignore
3126
3128
) {
@@ -3175,6 +3177,16 @@ Compiler.prototype._initRenderer = function _initRenderer () {
3175
3177
attrs += " title=\"" + title + "\"" ;
3176
3178
}
3177
3179
3180
+ var size = config . size ;
3181
+ if ( size ) {
3182
+ var sizes = size . split ( 'x' ) ;
3183
+ if ( sizes [ 1 ] ) {
3184
+ attrs += 'width=' + sizes [ 0 ] + ' height=' + sizes [ 1 ] ;
3185
+ } else {
3186
+ attrs += 'width=' + sizes [ 0 ] ;
3187
+ }
3188
+ }
3189
+
3178
3190
if ( ! isAbsolutePath ( href ) ) {
3179
3191
url = getPath ( contentBase , getParentPath ( router . getCurrentPath ( ) ) , href ) ;
3180
3192
}
@@ -3208,7 +3220,6 @@ Compiler.prototype.sidebar = function sidebar (text, level) {
3208
3220
3209
3221
if ( text ) {
3210
3222
html = this . compile ( text ) ;
3211
- html = html && html . match ( / < u l [ ^ > ] * > ( [ \s \S ] + ) < \/ u l > / g) [ 0 ] ;
3212
3223
} else {
3213
3224
var tree$$1 = this . cacheTree [ currentPath ] || genTree ( this . toc , level ) ;
3214
3225
html = tree ( tree$$1 , '<ul>' ) ;
@@ -3492,7 +3503,7 @@ function highlight(path) {
3492
3503
if ( ! last ) {
3493
3504
return
3494
3505
}
3495
- var li = nav [ getNavKey ( path , last . getAttribute ( 'data-id' ) ) ] ;
3506
+ var li = nav [ getNavKey ( decodeURIComponent ( path ) , last . getAttribute ( 'data-id' ) ) ] ;
3496
3507
3497
3508
if ( ! li || li === active ) {
3498
3509
return
@@ -3590,38 +3601,45 @@ function scroll2Top(offset) {
3590
3601
var cached$1 = { } ;
3591
3602
3592
3603
function walkFetchEmbed ( ref , cb ) {
3593
- var step = ref . step ; if ( step === void 0 ) step = 0 ;
3594
3604
var embedTokens = ref . embedTokens ;
3595
3605
var compile = ref . compile ;
3596
3606
var fetch = ref . fetch ;
3597
3607
3598
- var token = embedTokens [ step ] ;
3608
+ var token ;
3609
+ var step = 0 ;
3610
+ var count = 1 ;
3599
3611
3600
- if ( ! token ) {
3612
+ if ( ! embedTokens . length ) {
3601
3613
return cb ( { } )
3602
3614
}
3603
3615
3604
- var next = function ( text ) {
3605
- var embedToken ;
3606
- if ( text ) {
3607
- if ( token . embed . type === 'markdown' ) {
3608
- embedToken = compile . lexer ( text ) ;
3609
- } else if ( token . embed . type === 'code' ) {
3610
- embedToken = compile . lexer (
3611
- '```' +
3612
- token . embed . lang +
3613
- '\n' +
3614
- text . replace ( / ` / g, '@DOCSIFY_QM@' ) +
3615
- '\n```\n'
3616
- ) ;
3616
+ while ( ( token = embedTokens [ step ++ ] ) ) {
3617
+ var next = ( function ( token ) {
3618
+ return function ( text ) {
3619
+ var embedToken ;
3620
+ if ( text ) {
3621
+ if ( token . embed . type === 'markdown' ) {
3622
+ embedToken = compile . lexer ( text ) ;
3623
+ } else if ( token . embed . type === 'code' ) {
3624
+ embedToken = compile . lexer (
3625
+ '```' +
3626
+ token . embed . lang +
3627
+ '\n' +
3628
+ text . replace ( / ` / g, '@DOCSIFY_QM@' ) +
3629
+ '\n```\n'
3630
+ ) ;
3631
+ }
3632
+ }
3633
+ cb ( { token : token , embedToken : embedToken } ) ;
3634
+ if ( ++ count >= step ) {
3635
+ cb ( { } ) ;
3636
+ }
3617
3637
}
3618
- }
3619
- cb ( { token : token , embedToken : embedToken } ) ;
3620
- walkFetchEmbed ( { step : ++ step , compile : compile , embedTokens : embedTokens , fetch : fetch } , cb ) ;
3621
- } ;
3638
+ } ) ( token ) ;
3622
3639
3623
- {
3624
- get ( token . embed . url ) . then ( next ) ;
3640
+ {
3641
+ get ( token . embed . url ) . then ( next ) ;
3642
+ }
3625
3643
}
3626
3644
}
3627
3645
@@ -3706,7 +3724,9 @@ function formatUpdated(html, updated, fn) {
3706
3724
updated =
3707
3725
typeof fn === 'function' ?
3708
3726
fn ( updated ) :
3709
- typeof fn === 'string' ? tinydate ( fn ) ( new Date ( updated ) ) : updated ;
3727
+ typeof fn === 'string' ?
3728
+ tinydate ( fn ) ( new Date ( updated ) ) :
3729
+ updated ;
3710
3730
3711
3731
return html . replace ( / { d o c s i f y - u p d a t e d } / g, updated )
3712
3732
}
@@ -3911,6 +3931,10 @@ function initRender(vm) {
3911
3931
html += cover ( ) ;
3912
3932
}
3913
3933
3934
+ if ( config . logo ) {
3935
+ config . logo = getPath ( vm . router . getBasePath ( ) , config . logo ) ;
3936
+ }
3937
+
3914
3938
html += main ( config ) ;
3915
3939
// Render main app
3916
3940
vm . _renderTo ( el , html , true ) ;
@@ -4577,7 +4601,7 @@ initGlobalAPI();
4577
4601
/**
4578
4602
* Version
4579
4603
*/
4580
- Docsify . version = '4.6.10 ' ;
4604
+ Docsify . version = '4.7.0 ' ;
4581
4605
4582
4606
/**
4583
4607
* Run Docsify
0 commit comments