From 95448d27ae7d44b9e4803fd28f8c646495c91582 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 23 Apr 2026 19:10:52 +0100 Subject: [PATCH] fix: narrow Mintlify accordion guard --- scripts/check-docs-mdx.mjs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/check-docs-mdx.mjs b/scripts/check-docs-mdx.mjs index 3dfcce78447..ceac2e949d7 100644 --- a/scripts/check-docs-mdx.mjs +++ b/scripts/check-docs-mdx.mjs @@ -140,17 +140,27 @@ function checkMintlifyMdxStructure(filePath, raw) { accordionStack.push({ indent: openAccordion[1].length, line: index + 1, + hasOutdentedListItem: false, }); continue; } + const listItem = line.match(/^(\s*)[-*+]\s+/u); + if (listItem) { + for (const accordion of accordionStack) { + if (listItem[1].length < accordion.indent) { + accordion.hasOutdentedListItem = true; + } + } + } + const closeAccordion = line.match(/^(\s*)<\/Accordion>/u); if (!closeAccordion) { continue; } const opening = accordionStack.pop(); - if (opening && closeAccordion[1].length > opening.indent) { + if (opening && opening.hasOutdentedListItem && closeAccordion[1].length > opening.indent) { errors.push({ type: "mintlify-mdx", file: filePath,