File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/generators/legacy-json/utils Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,13 @@ export function parseListItem(child) {
8989 * @param {import('@types/mdast').RootContent[] } nodes
9090 */
9191export 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}
You can’t perform that action at this time.
0 commit comments