@@ -80,7 +80,8 @@ var config = merge({
80
80
mergeNavbar : false ,
81
81
formatUpdated : '' ,
82
82
externalLinkTarget : '_blank' ,
83
- routerModel : 'hash'
83
+ routerModel : 'hash' ,
84
+ noCompileLinks : [ ]
84
85
} , window . $docsify ) ;
85
86
86
87
var script = document . currentScript ||
@@ -2717,16 +2718,19 @@ function parseQuery (query) {
2717
2718
query . split ( '&' ) . forEach ( function ( param ) {
2718
2719
var parts = param . replace ( / \+ / g, ' ' ) . split ( '=' ) ;
2719
2720
2720
- res [ parts [ 0 ] ] = decode ( parts [ 1 ] ) ;
2721
+ res [ parts [ 0 ] ] = parts [ 1 ] && decode ( parts [ 1 ] ) ;
2721
2722
} ) ;
2723
+
2722
2724
return res
2723
2725
}
2724
2726
2725
2727
function stringifyQuery ( obj ) {
2726
2728
var qs = [ ] ;
2727
2729
2728
2730
for ( var key in obj ) {
2729
- qs . push ( ( ( encode ( key ) ) + "=" + ( encode ( obj [ key ] ) ) ) . toLowerCase ( ) ) ;
2731
+ qs . push ( obj [ key ]
2732
+ ? ( ( encode ( key ) ) + "=" + ( encode ( obj [ key ] ) ) ) . toLowerCase ( )
2733
+ : encode ( key ) ) ;
2730
2734
}
2731
2735
2732
2736
return qs . length ? ( "?" + ( qs . join ( '&' ) ) ) : ''
@@ -2757,6 +2761,8 @@ var cleanPath = cached(function (path) {
2757
2761
. replace ( / ( [ ^ : ] ) \/ { 2 , } / g, '$1/' )
2758
2762
} ) ;
2759
2763
2764
+ var cachedLinks = { } ;
2765
+
2760
2766
var Compiler = function Compiler ( config , router ) {
2761
2767
this . config = config ;
2762
2768
this . router = router ;
@@ -2791,6 +2797,19 @@ var Compiler = function Compiler (config, router) {
2791
2797
} ) ;
2792
2798
} ;
2793
2799
2800
+ Compiler . prototype . matchNotCompileLink = function matchNotCompileLink ( link ) {
2801
+ var links = this . config . noCompileLinks ;
2802
+
2803
+ for ( var i = 0 ; i < links . length ; i ++ ) {
2804
+ var n = links [ i ] ;
2805
+ var re = cachedLinks [ n ] || ( cachedLinks [ n ] = new RegExp ( ( "^" + n + "$" ) ) ) ;
2806
+
2807
+ if ( re . test ( link ) ) {
2808
+ return link
2809
+ }
2810
+ }
2811
+ } ;
2812
+
2794
2813
Compiler . prototype . _initRenderer = function _initRenderer ( ) {
2795
2814
var renderer = new marked . Renderer ( ) ;
2796
2815
var ref = this ;
@@ -2834,11 +2853,16 @@ Compiler.prototype._initRenderer = function _initRenderer () {
2834
2853
} ;
2835
2854
renderer . link = function ( href , title , text ) {
2836
2855
var blank = '' ;
2837
- if ( ! / : | ( \/ { 2 } ) / . test ( href ) ) {
2856
+
2857
+ if ( ! / : | ( \/ { 2 } ) / . test ( href ) &&
2858
+ ! _self . matchNotCompileLink ( href ) &&
2859
+ ! / ( \s ? : i g n o r e ) ( \s \S + ) ? $ / . test ( title ) ) {
2838
2860
href = router . toURL ( href , null , router . getCurrentPath ( ) ) ;
2839
2861
} else {
2840
2862
blank = " target=\"" + linkTarget + "\"" ;
2863
+ title = title && title . replace ( / : i g n o r e / g, '' ) . trim ( ) ;
2841
2864
}
2865
+
2842
2866
if ( title ) {
2843
2867
title = " title=\"" + title + "\"" ;
2844
2868
}
@@ -3200,6 +3224,10 @@ function renderMixin (proto) {
3200
3224
var this$1 = this ;
3201
3225
if ( opt === void 0 ) opt = { } ;
3202
3226
3227
+ if ( ! text ) {
3228
+ return renderMain . call ( this , text )
3229
+ }
3230
+
3203
3231
callHook ( this , 'beforeEach' , text , function ( result ) {
3204
3232
var html = this$1 . isHTML ? result : this$1 . compiler . compile ( result ) ;
3205
3233
if ( opt . updatedAt ) {
@@ -3298,8 +3326,15 @@ function initRender (vm) {
3298
3326
toggleClass ( body , 'ready' ) ;
3299
3327
}
3300
3328
3301
- function getAlias ( path , alias ) {
3302
- return alias [ path ] ? getAlias ( alias [ path ] , alias ) : path
3329
+ var cached$1 = { } ;
3330
+
3331
+ function getAlias ( path , alias , last ) {
3332
+ var match = Object . keys ( alias ) . filter ( function ( key ) {
3333
+ var re = cached$1 [ key ] || ( cached$1 [ key ] = new RegExp ( ( "^" + key + "$" ) ) ) ;
3334
+ return re . test ( path ) && path !== last
3335
+ } ) [ 0 ] ;
3336
+
3337
+ return match ? getAlias ( path . replace ( cached$1 [ match ] , alias [ match ] ) , alias , path ) : path
3303
3338
}
3304
3339
3305
3340
function getFileName ( path ) {
@@ -3623,17 +3658,24 @@ function fetchMixin (proto) {
3623
3658
// Current page is html
3624
3659
this . isHTML = / \. h t m l $ / g. test ( path ) ;
3625
3660
3626
- // Load main content
3627
- last . then ( function ( text , opt ) {
3628
- this$1 . _renderMain ( text , opt ) ;
3661
+ var loadSideAndNav = function ( ) {
3629
3662
if ( ! loadSidebar ) { return cb ( ) }
3630
3663
3631
3664
var fn = function ( result ) { this$1 . _renderSidebar ( result ) ; cb ( ) ; } ;
3632
3665
3633
3666
// Load sidebar
3634
3667
loadNested ( path , loadSidebar , fn , this$1 , true ) ;
3668
+ } ;
3669
+
3670
+ // Load main content
3671
+ last . then ( function ( text , opt ) {
3672
+ this$1 . _renderMain ( text , opt ) ;
3673
+ loadSideAndNav ( ) ;
3635
3674
} ,
3636
- function ( _ ) { return this$1 . _renderMain ( null ) ; } ) ;
3675
+ function ( _ ) {
3676
+ this$1 . _renderMain ( null ) ;
3677
+ loadSideAndNav ( ) ;
3678
+ } ) ;
3637
3679
3638
3680
// Load nav
3639
3681
loadNavbar &&
@@ -3758,7 +3800,7 @@ initGlobalAPI();
3758
3800
/**
3759
3801
* Version
3760
3802
*/
3761
- Docsify . version = '4.1.14 ' ;
3803
+ Docsify . version = '4.2.0 ' ;
3762
3804
3763
3805
/**
3764
3806
* Run Docsify
0 commit comments