@@ -207,38 +207,36 @@ export class Compiler {
207
207
*/
208
208
origin . heading = renderer . heading = function ( text , level ) {
209
209
let { str, config } = getAndRemoveConfig ( text ) ;
210
- const nextToc = { level, title : removeAtag ( str ) } ;
210
+ const nextToc = { level } ;
211
211
212
212
if ( / < ! - - { docsify-i g n o r e } - - > / g. test ( str ) ) {
213
213
str = str . replace ( '<!-- {docsify-ignore} -->' , '' ) ;
214
- nextToc . title = removeAtag ( str ) ;
215
214
nextToc . ignoreSubHeading = true ;
216
215
}
217
216
218
217
if ( / { d o c s i f y - i g n o r e } / g. test ( str ) ) {
219
218
str = str . replace ( '{docsify-ignore}' , '' ) ;
220
- nextToc . title = removeAtag ( str ) ;
221
219
nextToc . ignoreSubHeading = true ;
222
220
}
223
221
224
222
if ( / < ! - - { docsify-i g n o r e - a l l } - - > / g. test ( str ) ) {
225
223
str = str . replace ( '<!-- {docsify-ignore-all} -->' , '' ) ;
226
- nextToc . title = removeAtag ( str ) ;
227
224
nextToc . ignoreAllSubs = true ;
228
225
}
229
226
230
227
if ( / { d o c s i f y - i g n o r e - a l l } / g. test ( str ) ) {
231
228
str = str . replace ( '{docsify-ignore-all}' , '' ) ;
232
- nextToc . title = removeAtag ( str ) ;
233
229
nextToc . ignoreAllSubs = true ;
234
230
}
235
231
232
+ const title = config . sidebar || str ;
236
233
const slug = slugify ( config . id || str ) ;
237
234
const url = router . toURL ( router . getCurrentPath ( ) , { id : slug } ) ;
235
+ nextToc . title = removeAtag ( title ) ;
238
236
nextToc . slug = url ;
239
237
_self . toc . push ( nextToc ) ;
240
238
241
- return `<h${ level } id="${ slug } "><a href="${ url } " data-id="${ slug } " class="anchor"><span>${ str } </span></a></h${ level } >` ;
239
+ return `<h${ level } id="${ slug } "><a href="${ url } " data-id="${ slug } " class="anchor"><span>${ title } </span></a></h${ level } >` ;
242
240
} ;
243
241
244
242
origin . code = highlightCodeCompiler ( { renderer } ) ;
0 commit comments