const { contentAsText } = require('../helpers.js') const marked = require('marked') module.exports = async function (doc, rootLevel) { const { next, line, match, tail, level, head } = doc const node = { type: head(), class: '', text: '' } while (await next(rootLevel)) { if (match('class')) node.class = tail() else { node.text = marked.parse(await contentAsText(doc, rootLevel, true)) } } return node }