Move to custom SSG instead of eleventy.

This commit is contained in:
Joshua Bemenderfer
2023-03-04 22:36:08 -05:00
parent 31bb42e985
commit f42225bd13
59 changed files with 337 additions and 1784 deletions

16
docs/read-page/helpers.js Normal file
View File

@@ -0,0 +1,16 @@
export async function contentAsText (doc, rootLevel, includeCurrent = false) {
const { level, next, line, head } = doc
const linesAsArray = []
if (includeCurrent) linesAsArray.push(line())
let contentDepth = includeCurrent ? level() : -1
while(await next(rootLevel)) {
if (contentDepth === -1 && !!line()) contentDepth = level()
const indent = ''.padStart(level() - contentDepth, ' ')
linesAsArray.push(indent + line())
}
return linesAsArray.join('\n')
}