diff --git a/lib/get-mini-toc-items.js b/lib/get-mini-toc-items.js index 0f6431692a95..4cacc81d5a96 100644 --- a/lib/get-mini-toc-items.js +++ b/lib/get-mini-toc-items.js @@ -15,6 +15,12 @@ module.exports = function getMiniTocItems (html, maxHeadingLevel = 3) { // - `platform` to show or hide platform-specific headings via client JS const items = headings .get() + .filter(item => { + if (!item.parent) return true + // Hide any items that belong to a hidden div + const { attribs } = item.parent + return !('hidden' in attribs) + }) .map(item => { // remove any tags including their content $('span').remove()