Skip to content

Commit e6ac14a

Browse files
committed
more diffs
1 parent d216606 commit e6ac14a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/generators/legacy-json/utils/parseList.mjs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,13 @@ export function parseListItem(child) {
8989
* @param {import('@types/mdast').RootContent[]} nodes
9090
*/
9191
export function parseList(section, nodes) {
92-
const list = nodes[0]?.type === 'list' ? nodes.shift() : null;
92+
const listIdx = nodes.findIndex(createQueries.UNIST.isTypedList);
93+
const list = nodes[listIdx];
9394

9495
const values = list ? list.children.map(parseListItem) : [];
9596

97+
let removeList = true;
98+
9699
// Update the section based on its type and parsed values
97100
switch (section.type) {
98101
case 'ctor':
@@ -124,9 +127,10 @@ export function parseList(section, nodes) {
124127
break;
125128

126129
default:
127-
// If no specific handling, re-add the list for further processing
128-
if (list) {
129-
nodes.unshift(list);
130-
}
130+
removeList = false;
131+
}
132+
133+
if (removeList && list) {
134+
nodes.splice(listIdx, 1);
131135
}
132136
}

0 commit comments

Comments
 (0)