import knownNodes from './index.js' export default async function (doc, rootLevel, ...args) { const { next, line, match, tail, level, head } = doc const node = { type: head(), class: '', children: [] } while (await next(rootLevel)) { if (!head()) continue const block = head() if (match('class')) { node.class = tail() continue } if (!knownNodes[block]) continue node.children.push(await knownNodes[block](doc, level(), ...args)) } return node }