@@ -190,26 +190,27 @@ export class Compiler {
190190 * @link https://github.com/markedjs/marked#overriding-renderer-methods
191191 */
192192 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 }
194195
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
198199 nextToc . ignoreSubHeading = true
199200 }
200201
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
204205 nextToc . ignoreAllSubs = true
205206 }
206207
207- const slug = slugify ( text )
208+ const slug = slugify ( config . id || str )
208209 const url = router . toURL ( router . getCurrentPath ( ) , { id : slug } )
209210 nextToc . slug = url
210211 _self . toc . push ( nextToc )
211212
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 } >`
213214 }
214215 // Highlight code
215216 origin . code = renderer . code = function ( code , lang = '' ) {
0 commit comments