diff --git a/lib/get-mini-toc-items.js b/lib/get-mini-toc-items.js index 73152536e6fd..d59be2de6042 100644 --- a/lib/get-mini-toc-items.js +++ b/lib/get-mini-toc-items.js @@ -35,6 +35,14 @@ export default function getMiniTocItems(html, maxHeadingLevel = 2, headingScope // Capture the anchor tag nested within the header, get its href and remove it const anchor = $('a.doctocat-link', item) const href = anchor.attr('href') + if (!href) { + // Can happen if the, for example, `