@@ -190,26 +190,27 @@ export class Compiler {
190
190
* @link https://github.com/markedjs/marked#overriding-renderer-methods
191
191
*/
192
192
origin . heading = renderer . heading = function ( text , level ) {
193
- const nextToc = { level, title : text }
193
+ let { str, config} = getAndRemoveConfig ( text )
194
+ const nextToc = { level, title : str }
194
195
195
- if ( / { d o c s i f y - i g n o r e } / g. test ( text ) ) {
196
- text = text . replace ( '{docsify-ignore}' , '' )
197
- nextToc . title = text
196
+ if ( / { d o c s i f y - i g n o r e } / g. test ( str ) ) {
197
+ str = str . replace ( '{docsify-ignore}' , '' )
198
+ nextToc . title = str
198
199
nextToc . ignoreSubHeading = true
199
200
}
200
201
201
- if ( / { d o c s i f y - i g n o r e - a l l } / g. test ( text ) ) {
202
- text = text . replace ( '{docsify-ignore-all}' , '' )
203
- nextToc . title = text
202
+ if ( / { d o c s i f y - i g n o r e - a l l } / g. test ( str ) ) {
203
+ str = str . replace ( '{docsify-ignore-all}' , '' )
204
+ nextToc . title = str
204
205
nextToc . ignoreAllSubs = true
205
206
}
206
207
207
- const slug = slugify ( text )
208
+ const slug = slugify ( config . id || str )
208
209
const url = router . toURL ( router . getCurrentPath ( ) , { id : slug } )
209
210
nextToc . slug = url
210
211
_self . toc . push ( nextToc )
211
212
212
- return `<h${ level } id="${ slug } "><a href="${ url } " data-id="${ slug } " class="anchor"><span>${ text } </span></a></h${ level } >`
213
+ return `<h${ level } id="${ slug } "><a href="${ url } " data-id="${ slug } " class="anchor"><span>${ str } </span></a></h${ level } >`
213
214
}
214
215
// Highlight code
215
216
origin . code = renderer . code = function ( code , lang = '' ) {
0 commit comments