docs(api): per-symbol pages, fuzzy search, deep token linking, hover cards
All checks were successful
docs / build-and-deploy (push) Successful in 2s
All checks were successful
docs / build-and-deploy (push) Successful in 2s
Rebuild the API Reference around one page per symbol and richer, verified content.
Pages & navigation
- One HTML page per symbol (kw-*, type-*, phase-*, screen-*, fn-*, annot-*, op-*)
instead of a single scrolling page; namespace overview pages (ns-screen …
ns-color) and a searchable index (api.html) with client-side fuzzy search.
- Sticky-header scroll offset (scroll-margin) so a jumped-to entry/param/color is
never hidden, plus a flash highlight on the scrolled-to target.
Deep linking in every snippet & example
- Namespace members split: `Screen`→namespace page, `fill_rectangle`→method page;
`Color`→palette page, `Charcoal`→its swatch — separately.
- Named arguments (`width:`) link to that parameter's anchor on the method page.
- Hover any token for a summary card built from the real API data (symbols.json).
Content & coverage
- Full authoritative surface documented from the compiler: every keyword, type,
the 6 phases (Start/Input/FixedUpdate/Update/LateUpdate/Render, each its own
page), all 22 annotations, namespace methods with parameter docs, builtins,
the world_* reflection ABI, networking, operators — 155 symbols.
- Longer, clearer explanations; "model"/"model instance" terminology, not "entity";
descriptive identifiers in every example (Position{column,row}, Velocity{delta_x,
delta_y}, Health{current,maximum}, Player/Enemy) — no Pos/Seg/x/dx.
- Accuracy fixes from compiler ground-truth: world_count() takes no arg,
world_query_next(property, cursor) arg order, event fields bind by name; dropped
`when` and `module` (not in the self-hosted parser).
Tooling
- inventory.json + check.py: coverage guard (every symbol has a page), duplicate-
token guard, and broken-link guard — fail CI so docs can't drift.
- validate.py: compiles every ```ludic example against bin/ludicc (158 compile).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
25f987e30d
commit
3c7ec9b016
172 changed files with 5240 additions and 895 deletions
|
|
@ -7,61 +7,81 @@ source of truth, so the site can never drift from the language.
|
|||
|
||||
```
|
||||
docs/
|
||||
language/<category>/<id>.md one file per symbol — keyword, type, builtin,
|
||||
namespace method, operator, annotation
|
||||
language/<category>/<id>.md one file per symbol — keyword, type, phase,
|
||||
builtin, namespace method, operator, annotation
|
||||
language/<category>/_section.md section title + blurb + order
|
||||
language/colors/palette.json the 221 named colors (generated by palette.py)
|
||||
site/site.json landing-page messaging (hero, features, …)
|
||||
site/snippets/*.ludic the code shown on the landing page (real programs)
|
||||
tools/docgen/inventory.json the authoritative symbol set the coverage guard checks
|
||||
```
|
||||
|
||||
### A symbol file
|
||||
|
||||
```markdown
|
||||
---
|
||||
id: kw-handler # anchor in api.html (kw-*, type-*, fn-*, <ns>-*, op-*, annot-*)
|
||||
name: handler # display name / heading
|
||||
category: control # which section (matches the directory)
|
||||
kind: keyword # keyword | type | phase | namespace-method | builtin | annotation | operator
|
||||
tokens: handler # the literal token(s) the highlighter recognizes & links
|
||||
sig: handler Name phase P { … }
|
||||
tip: A block that runs each frame in a given phase. # one-line hover tip
|
||||
order: 3
|
||||
id: screen-fill_rectangle # anchor + page name (screen-fill_rectangle.html)
|
||||
name: Screen.fill_rectangle
|
||||
category: screen
|
||||
kind: namespace-method # keyword|type|phase|namespace-method|builtin|annotation|operator
|
||||
tokens: Screen.fill_rectangle # literal token(s) the highlighter matches & links
|
||||
sig: Screen.fill_rectangle(x, y, width, height, color)
|
||||
tip: Draw a solid, filled rectangle. # one sentence — the hover-card summary
|
||||
order: 1
|
||||
ns: Screen # namespace-method only
|
||||
member: fill_rectangle # namespace-method only
|
||||
related: screen-clear screen-draw_rectangle
|
||||
---
|
||||
|
||||
Full description — inline HTML (`<code>`, `<b>`) and `backtick code` both work.
|
||||
Rich description — inline `<code>`/`backticks`, "model instance" language.
|
||||
|
||||
```ludic
|
||||
handler Move phase Update { … }
|
||||
```
|
||||
Parameters: # for anything that takes arguments
|
||||
- `x` — the left edge, in pixels
|
||||
- `color` — the fill color, e.g. a `Color.*` name
|
||||
|
||||
```ludic
|
||||
program Example { … descriptive-named, compilable … }
|
||||
```
|
||||
```
|
||||
|
||||
Add such a file and it appears in the API Reference, is recognized + tipped +
|
||||
linked in **every** code snippet across the site, and lands in `symbols.json` —
|
||||
with no other file to edit.
|
||||
## What it produces
|
||||
|
||||
## Build
|
||||
One **page per symbol** (`<id>.html`), a namespace overview page per namespace
|
||||
(`ns-screen.html` … `ns-color.html`), a searchable **index** (`api.html`, fuzzy
|
||||
search over every symbol), the **landing page** (`index.html`), the
|
||||
`ludic-highlight.js` highlighter (all its symbol tables, tips, per-item link
|
||||
targets, per-parameter anchors and hover-card data generated from the sources
|
||||
above), `symbols.json`, and `.nojekyll`.
|
||||
|
||||
In any code sample: keywords/types/builtins/annotations link to their page;
|
||||
`Screen.fill_rectangle` links `Screen` → the namespace page and `fill_rectangle`
|
||||
→ the method page separately; a named argument like `width:` links to that
|
||||
parameter's anchor; `Color.Charcoal` links `Color` and `Charcoal` separately;
|
||||
hovering any token shows a summary card from the real API data.
|
||||
|
||||
## Build & check
|
||||
|
||||
```bash
|
||||
python3 tools/docgen/gen.py --out build/pages # generate the whole site
|
||||
python3 tools/docgen/check.py build/pages # sanity-check before publish
|
||||
python3 tools/docgen/gen.py --out build/pages # generate the whole site
|
||||
python3 tools/docgen/check.py build/pages # coverage + duplicate-token + link guard
|
||||
python3 tools/docgen/validate.py # compile every ```ludic example with bin/ludicc
|
||||
```
|
||||
|
||||
Outputs into `--out`: `index.html`, `api.html`, `ludic-highlight.js`
|
||||
(its symbol tables generated from the sources above), `symbols.json`, `.nojekyll`.
|
||||
`check.py` fails CI if any symbol in `inventory.json` lacks a page, if a token is
|
||||
documented on two pages, or if a highlighter link points at a missing page — so
|
||||
"every symbol is documented, autogenerated each time" is enforced. `validate.py`
|
||||
needs a built `bin/ludicc`; the deploy CI is Python-only, so run it locally or in
|
||||
a toolchain-enabled job.
|
||||
|
||||
No third-party dependencies — Python standard library only.
|
||||
|
||||
## Publish
|
||||
|
||||
`.forgejo/workflows/docs.yml` runs this on every push to `main` that touches
|
||||
`docs/**` or `tools/docgen/**`, and force-publishes the result to the `pages`
|
||||
branch root (which the pages-server serves). It needs a repo secret
|
||||
`PAGES_TOKEN` with write access (or the automatic Actions token enabled for
|
||||
pushes). `index.html` + `.nojekyll` always stay at the branch root.
|
||||
`.forgejo/workflows/docs.yml` runs `gen.py` + `check.py` on every push to `main`
|
||||
that touches `docs/**` or `tools/docgen/**`, and publishes the result to the
|
||||
`pages` branch root. `index.html` + `.nojekyll` always stay at the root.
|
||||
|
||||
## Colors
|
||||
|
||||
`palette.json` is generated by `tools/docgen/palette.py` from a single `PALETTE`
|
||||
table, which also generates `selfhost/emit_color.ludic`. Regenerate colors
|
||||
there; never hand-edit either output.
|
||||
table, which also generates `selfhost/emit_color.ludic`. Regenerate colors there.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue