-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
Description
Background
Knockout has a lot of documentation, much of which is application to TKO as well. It's mostly written in Markdown. I've written a little documentation in Markdown as well.
In general, Markdown is an easily accessible format for documentation, but sufficiently dynamic that we should be able to reference everything from there.
Objective
- Add documentation to this monorepo
- Deploy the documentation with an automated command to e.g. Github Pages or Firebase (both being Fastly)
- Create a Github Action to auto-deploy on changes
Technical discussion
Some documentation is at:
The unified, remark processor looks to be an excellent preprocessor, with a good AST generator like this:
#!/usr/bin/env node
const fs = require('fs')
const unified = require('unified')
const markdown = require('remark-parse')
const html = require('remark-html');
const markdownText = fs.readFileSync('/dev/stdin', 'utf8')
unified()
.use(markdown)
.use(() => tree => console.log(JSON.stringify(tree, null, 2)))
.use(html)
.processSync(markdownText)
.toString();What might make sense is to skip the AST, or even JSX, and jump right to our own JSX object representation i.e.
interface JsxObject {
element: string // tagName
children?: JsxObject[],
attributes?: Record<string, string>,
}We'd need to create our own html-like processor that generates the JSX, but we could generate .json files that we could do something trivial to load the page like this:
observable(tko.jsx.createElement(await import('./docs/doc-as-markdown.json'))