mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:30:43 +00:00
fix: prevent malformed docs accordions
This commit is contained in:
@@ -20,27 +20,17 @@ function visitAccordionIndentation(raw, onMisindentedClose) {
|
||||
if (openAccordion) {
|
||||
accordionStack.push({
|
||||
indent: openAccordion[1].length,
|
||||
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 && opening.hasOutdentedListItem && closeAccordion[1].length > opening.indent) {
|
||||
if (opening && closeAccordion[1].length > opening.indent) {
|
||||
onMisindentedClose({ closeAccordion, index, line, lines, opening });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user