Started working on JS docs.

This commit is contained in:
Joshua Bemenderfer
2023-02-14 22:24:59 -05:00
parent 91ca89f158
commit 4156e3bf91
24 changed files with 364 additions and 69 deletions

View File

@@ -8,15 +8,23 @@ module.exports = async (doc, rootLevel) => {
const node = {
type: head(),
class: '',
languages: {}
summaryClass: 'mb-[400px]',
preClass: 'max-h-[400px]',
examples: []
}
while (await next(rootLevel)) {
if (match('class')) node.class = tail()
if (match('summary-class')) node.summaryClass = tail()
if (match('pre-class')) node.preClass = tail()
const languageLevel = level()
const exampleLevel = level()
if (languages.includes(head())) {
node.languages[head()] = await contentAsText(doc, languageLevel)
node.examples.push({
language: head(),
name: tail() || '',
code: await contentAsText(doc, exampleLevel)
})
}
}