11/**
22 * @typedef {import('hast').Element } Element
33 * @typedef {import('hast').ElementContent } ElementContent
4- * @typedef { import('mdast').List } List
4+ *
55 * @typedef {import('mdast').BlockContent } BlockContent
66 * @typedef {import('mdast').DefinitionContent } DefinitionContent
7+ * @typedef {import('mdast').List } List
78 * @typedef {import('mdast').ListContent } ListContent
9+ * @typedef {import('mdast').ListItem } ListItem
10+ *
811 * @typedef {import('../state.js').State } State
912 *
13+ */
14+
15+ /**
1016 * @typedef Group
1117 * Title/definition group.
1218 * @property {Array<Element> } titles
@@ -20,7 +26,7 @@ import {listItemsSpread} from '../util/list-items-spread.js'
2026/**
2127 * @param {State } state
2228 * State.
23- * @param {Element } node
29+ * @param {Readonly< Element> } node
2430 * hast element to transform.
2531 * @returns {List | undefined }
2632 * mdast node.
@@ -44,7 +50,7 @@ export function dl(state, node) {
4450 }
4551
4652 /** @type {Group } */
47- let group = { titles : [ ] , definitions : [ ] }
53+ let group = { definitions : [ ] , titles : [ ] }
4854 index = - 1
4955
5056 // Group titles and definitions.
@@ -60,7 +66,7 @@ export function dl(state, node) {
6066 previous . tagName === 'dd'
6167 ) {
6268 groups . push ( group )
63- group = { titles : [ ] , definitions : [ ] }
69+ group = { definitions : [ ] , titles : [ ] }
6470 }
6571
6672 group . titles . push ( child )
@@ -116,12 +122,7 @@ export function dl(state, node) {
116122 * mdast nodes.
117123 */
118124function handle ( state , children ) {
119- const nodes = state . all ( {
120- type : 'element' ,
121- tagName : 'x' ,
122- properties : { } ,
123- children
124- } )
125+ const nodes = state . all ( { type : 'root' , children} )
125126 const listItems = state . toSpecificContent ( nodes , create )
126127
127128 if ( listItems . length === 0 ) {
@@ -144,7 +145,7 @@ function handle(state, children) {
144145}
145146
146147/**
147- * @returns {ListContent }
148+ * @returns {ListItem }
148149 */
149150function create ( ) {
150151 return { type : 'listItem' , spread : false , checked : null , children : [ ] }
0 commit comments