@@ -57,16 +57,18 @@ export function init () {
57
57
return `<p>${ text } </p>`
58
58
}
59
59
60
- if ( typeof __docsify__ . markdown === 'function' ) {
60
+ if ( typeof $docsify . markdown === 'function' ) {
61
61
markdown . setOptions ( { renderer } )
62
- markdown = __docsify__ . markdown . call ( this , markdown )
62
+ markdown = $docsify . markdown . call ( this , markdown )
63
63
} else {
64
- markdown . setOptions ( merge ( { renderer } , __docsify__ . markdown ) )
64
+ markdown . setOptions ( merge ( { renderer } , $docsify . markdown ) )
65
65
}
66
66
67
67
const md = markdown
68
68
69
69
markdown = text => emojify ( md ( text ) )
70
+
71
+ window . Docsify . utils . marked = markdown
70
72
}
71
73
72
74
/**
@@ -75,23 +77,29 @@ export function init () {
75
77
export function renderApp ( dom , replace ) {
76
78
const nav = document . querySelector ( 'nav' ) || document . createElement ( 'nav' )
77
79
78
- if ( ! __docsify__ . repo ) nav . classList . add ( 'no-badge' )
80
+ if ( ! $docsify . repo ) nav . classList . add ( 'no-badge' )
79
81
80
- dom [ replace ? 'outerHTML' : 'innerHTML' ] = tpl . corner ( __docsify__ . repo ) +
81
- ( __docsify__ . coverpage ? tpl . cover ( ) : '' ) +
82
+ dom [ replace ? 'outerHTML' : 'innerHTML' ] = tpl . corner ( $docsify . repo ) +
83
+ ( $docsify . coverpage ? tpl . cover ( ) : '' ) +
82
84
tpl . main ( )
83
85
document . body . insertBefore ( nav , document . body . children [ 0 ] )
84
86
85
87
// theme color
86
- if ( __docsify__ . themeColor ) {
87
- document . head . innerHTML += tpl . theme ( __docsify__ . themeColor )
88
+ if ( $docsify . themeColor ) {
89
+ document . head . innerHTML += tpl . theme ( $docsify . themeColor )
88
90
polyfill . cssVars ( )
89
91
}
90
92
93
+ // render name
94
+ if ( $docsify . name ) {
95
+ const aside = document . querySelector ( '.sidebar' )
96
+ aside . innerHTML = `<h1><a href="${ $docsify . nameLink } ">${ $docsify . name } </a></h1>` + aside . innerHTML
97
+ }
98
+
91
99
// bind toggle
92
100
event . bindToggle ( 'button.sidebar-toggle' )
93
101
// bind sticky effect
94
- if ( __docsify__ . coverpage ) {
102
+ if ( $docsify . coverpage ) {
95
103
! isMobile ( ) && window . addEventListener ( 'scroll' , event . sticky )
96
104
} else {
97
105
document . body . classList . add ( 'sticky' )
@@ -103,7 +111,7 @@ export function renderApp (dom, replace) {
103
111
*/
104
112
export function renderArticle ( content ) {
105
113
renderTo ( 'article' , content ? markdown ( content ) : 'not found' )
106
- if ( ! __docsify__ . loadSidebar ) renderSidebar ( )
114
+ if ( ! $docsify . loadSidebar ) renderSidebar ( )
107
115
108
116
if ( content && typeof Vue !== 'undefined' ) {
109
117
CACHE . vm && CACHE . vm . $destroy ( )
@@ -120,7 +128,7 @@ export function renderArticle (content) {
120
128
: new Vue ( { el : 'main' } ) // eslint-disable-line
121
129
CACHE . vm && CACHE . vm . $nextTick ( _ => event . scrollActiveSidebar ( ) )
122
130
}
123
- if ( __docsify__ . auto2top ) setTimeout ( ( ) => event . scroll2Top ( __docsify__ . auto2top ) , 0 )
131
+ if ( $docsify . auto2top ) setTimeout ( ( ) => event . scroll2Top ( $docsify . auto2top ) , 0 )
124
132
}
125
133
126
134
/**
@@ -145,21 +153,21 @@ export function renderSidebar (content) {
145
153
// find url tag
146
154
html = html . match ( / < u l [ ^ > ] * > ( [ \s \S ] + ) < \/ u l > / g) [ 0 ]
147
155
} else {
148
- html = tpl . tree ( genTree ( toc , __docsify__ . maxLevel ) , '<ul>' )
156
+ html = tpl . tree ( genTree ( toc , $docsify . maxLevel ) , '<ul>' )
149
157
}
150
158
151
- html = ( __docsify__ . name ? `<h1><a href=" ${ __docsify__ . nameLink } "> ${ __docsify__ . name } </a></h1>` : '' ) + html
152
- renderTo ( 'aside .sidebar' , html )
153
- const target = event . activeLink ( 'aside .sidebar' , true )
159
+ console . log ( html )
160
+ renderTo ( '.sidebar>div ' , html )
161
+ const target = event . activeLink ( '.sidebar>div ' , true )
154
162
if ( target ) renderSubSidebar ( target )
155
163
toc = [ ]
156
164
157
165
event . scrollActiveSidebar ( )
158
166
}
159
167
160
168
export function renderSubSidebar ( target ) {
161
- if ( ! __docsify__ . subMaxLevel ) return
162
- target . parentNode . innerHTML += tpl . tree ( genTree ( toc , __docsify__ . subMaxLevel ) , '<ul>' )
169
+ if ( ! $docsify . subMaxLevel ) return
170
+ target . parentNode . innerHTML += tpl . tree ( genTree ( toc , $docsify . subMaxLevel ) , '<ul>' )
163
171
}
164
172
165
173
/**
0 commit comments