17 lines
341 B
JavaScript
17 lines
341 B
JavaScript
module.exports = async function (doc, rootLevel) {
|
|
const { next, line, match, tail, level, head } = doc
|
|
|
|
const node = {
|
|
type: head(),
|
|
level: tail().split(' ')[0],
|
|
text: tail().split(' ').slice(1).join(' '),
|
|
class: ''
|
|
}
|
|
|
|
while (await next(rootLevel)) {
|
|
if (match('class')) node.class = tail()
|
|
}
|
|
|
|
return node
|
|
}
|