@@ -205,13 +205,14 @@ export class Compiler {
205205 /**
206206 * Render anchor tag
207207 * @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)
210210 * @returns {String } Heading element
211211 */
212- origin . heading = renderer . heading = function ( text , level ) {
212+ origin . heading = renderer . heading = function ( { tokens, depth } ) {
213+ const text = this . parser . parseInline ( tokens ) ;
213214 let { str, config } = getAndRemoveConfig ( text ) ;
214- const nextToc = { level , title : str } ;
215+ const nextToc = { depth , title : str } ;
215216
216217 const { content, ignoreAllSubs, ignoreSubHeading } =
217218 getAndRemoveDocsifyIgnoreConfig ( str ) ;
@@ -229,7 +230,7 @@ export class Compiler {
229230 // elements after navigation. This is preferred over focusing on the link
230231 // within the heading because it matches the focus behavior of screen
231232 // 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 } >` ;
233234 } ;
234235
235236 origin . code = highlightCodeCompiler ( { renderer } ) ;
0 commit comments