First pass at hero section.

This commit is contained in:
Joshua Bemenderfer
2023-02-12 20:49:04 -05:00
parent 95842b73bd
commit df3aa36e26
14 changed files with 112 additions and 18 deletions

View File

@@ -1,9 +1,9 @@
module.exports.contentAsText = async function(doc, rootLevel) {
module.exports.contentAsText = async function(doc, rootLevel, includeCurrent = false) {
const { level, next, line, head } = doc
const linesAsArray = []
let contentDepth = -1
if (includeCurrent) linesAsArray.push(line())
let contentDepth = includeCurrent ? level() : -1
while(await next(rootLevel)) {
if (contentDepth === -1 && !!line()) contentDepth = level()