@@ -205,13 +205,14 @@ export class Compiler {
205
205
/**
206
206
* Render anchor tag
207
207
* @link https://github.com/markedjs/marked#overriding-renderer-methods
208
- * @param {String } text Text content
209
- * @param {Number } level Type of heading (h<level> tag)
208
+ * @param {String } tokens the content tokens
209
+ * @param {Number } depth Type of heading (h<level> tag)
210
210
* @returns {String } Heading element
211
211
*/
212
- origin . heading = renderer . heading = function ( text , level ) {
212
+ origin . heading = renderer . heading = function ( { tokens, depth } ) {
213
+ const text = this . parser . parseInline ( tokens ) ;
213
214
let { str, config } = getAndRemoveConfig ( text ) ;
214
- const nextToc = { level , title : str } ;
215
+ const nextToc = { depth , title : str } ;
215
216
216
217
const { content, ignoreAllSubs, ignoreSubHeading } =
217
218
getAndRemoveDocsifyIgnoreConfig ( str ) ;
@@ -229,7 +230,7 @@ export class Compiler {
229
230
// elements after navigation. This is preferred over focusing on the link
230
231
// within the heading because it matches the focus behavior of screen
231
232
// readers when navigating page content.
232
- return `<h${ level } id="${ slug } " tabindex="-1"><a href="${ url } " data-id="${ slug } " class="anchor"><span>${ str } </span></a></h${ level } >` ;
233
+ return `<h${ depth } id="${ slug } " tabindex="-1"><a href="${ url } " data-id="${ slug } " class="anchor"><span>${ str } </span></a></h${ depth } >` ;
233
234
} ;
234
235
235
236
origin . code = highlightCodeCompiler ( { renderer } ) ;
0 commit comments