@@ -207,38 +207,36 @@ export class Compiler {
207207 */
208208 origin . heading = renderer . heading = function ( text , level ) {
209209 let { str, config } = getAndRemoveConfig ( text ) ;
210- const nextToc = { level, title : removeAtag ( str ) } ;
210+ const nextToc = { level } ;
211211
212212 if ( / < ! - - { docsify-i g n o r e } - - > / g. test ( str ) ) {
213213 str = str . replace ( '<!-- {docsify-ignore} -->' , '' ) ;
214- nextToc . title = removeAtag ( str ) ;
215214 nextToc . ignoreSubHeading = true ;
216215 }
217216
218217 if ( / { d o c s i f y - i g n o r e } / g. test ( str ) ) {
219218 str = str . replace ( '{docsify-ignore}' , '' ) ;
220- nextToc . title = removeAtag ( str ) ;
221219 nextToc . ignoreSubHeading = true ;
222220 }
223221
224222 if ( / < ! - - { docsify-i g n o r e - a l l } - - > / g. test ( str ) ) {
225223 str = str . replace ( '<!-- {docsify-ignore-all} -->' , '' ) ;
226- nextToc . title = removeAtag ( str ) ;
227224 nextToc . ignoreAllSubs = true ;
228225 }
229226
230227 if ( / { d o c s i f y - i g n o r e - a l l } / g. test ( str ) ) {
231228 str = str . replace ( '{docsify-ignore-all}' , '' ) ;
232- nextToc . title = removeAtag ( str ) ;
233229 nextToc . ignoreAllSubs = true ;
234230 }
235231
232+ const title = config . sidebar || str ;
236233 const slug = slugify ( config . id || str ) ;
237234 const url = router . toURL ( router . getCurrentPath ( ) , { id : slug } ) ;
235+ nextToc . title = removeAtag ( title ) ;
238236 nextToc . slug = url ;
239237 _self . toc . push ( nextToc ) ;
240238
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 } >` ;
242240 } ;
243241
244242 origin . code = highlightCodeCompiler ( { renderer } ) ;
0 commit comments