Terrace/docs/read-page/nodes/TableOfContents.js
2023-03-04 22:36:08 -05:00

15 lines
246 B
JavaScript

export default async function (doc, rootLevel) {
const { next, head, tail, match } = doc
const node = {
type: head(),
class: '',
}
while (await next(rootLevel)) {
if (match('class')) node.class = tail()
}
return node
}