const knownNodes = require('./index.js') module.exports = async function (doc, rootLevel) { 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())) } return node }