import knownNodes from './index.js' export default async function (doc, rootNode, ...args) { const node = { type: rootNode.head, class: '', children: [] } for await (const child of rootNode.children()) { if (!child.head) continue const block = child.head if (child.is('class')) { node.class = child.tail continue } if (!knownNodes[block]) continue node.children.push(await knownNodes[block](doc, child, ...args)) } return node }