a reactive (signals based) hypermedia web framework (wip)
stormlightlabs.github.io/volt/
hypermedia
frontend
signals
1# Contributing to VoltX
2
3## Documentation
4
5### API Doc Parser Spec
6
7- `docsCommand` currently walks every `.ts` file under `src/` and emits markdown for exported functions, interfaces, and type aliases.
8 - Extend `parseFile` before adding new declaration shapes so documentation stays complete.
9- When enhancing the parser:
10 - Normalize all leading whitespace with the `getFullText` helpers
11 - Prefer passing structured data (description, tags, examples) into `generateMD`.
12 - Avoid baking markdown formatting inside the extractor so the generator can evolve independently.
13- Preserve ordering: `parseFile` visits nodes in source order.
14 - When adding new collectors, keep this invariant so the docs mirror the file’s story.
15- Add unit coverage under `test/dev/docs-parser.test.ts` (or a new spec) whenever you touch comment parsing.
16 - Sample TS files with edge-case syntax (generics, overloads, multi-line examples) make regressions easy to catch.
17- After updating comments or the parser, build new API docs and inspect the refreshed files in `docs/api/` before submitting changes
18
19### Writing API Documentation (TypeScript)
20
21- Start each source file that ships public APIs with a `@packageDocumentation` tag
22 - Give a one-sentence summary on the first line, follow with paragraphs that explain when to reach for the module
23 - Avoid other tags in this block so `extractModDocs` can surface clean prose (see `dev/src/commands/docs.ts`).
24- Document every exported symbol (functions, interfaces, types, classes, consts) with a JSDoc block placed immediately above the declaration.
25 - Keep the first sentence under 121 characters; subsequent sentences can wrap naturally.\
26 - Publicly exported symbols are in entry points (`index.ts`, `debug.ts`)
27- Structure symbol docs as:
28 1. Summary line
29 2. Optional paragraphs
30 3. `@remarks` for nuance
31 4. Any number of `@example` blocks
32 - Use markdown code block syntax tagged with `ts` or `typescript`
33- The parser doesn't render `@param`, `@returns`, and `@throws` (as of 2025-10-20),
34 - Fold critical argument and return-value notes into `@remarks` or provide a short table in markdown
35 - When the parser gains tag support, prefer one tag per line (`@param input Signal to watch`) so it can be emitted as a definition list
36- Use deliberate naming in overloads and generics; the generator flattens signatures (`extractFnSig`) and shows exactly what the compiler sees.
37 - Keep overloads minimal and consider documenting helper types separately if they deserve their own section.
38
39### Writing CSS Documentation
40
41- Place JSDoc-style blocks immediately above the selector or at-rule they describe.
42 - The CSS parser associates the next non-empty line that opens a block with the comment so keep unrelated declarations between the comment and selector out of the way.
43 - See `extractCSSComments` in `dev/src/commands/css-docs.ts`
44- Keep comments under ~180 characters or split them into multiple sentences
45 - `generateSemanticsDocs` currently (2025-10-20) discards longer blobs
46 - Should answer:
47 1. "What does this selector represent?"
48 2. "Why does it exist?"
49- Explain theme or state-specific overrides (`@media`, `[data-variant]`, etc.) directly in the comment so the semantics page contextualizes duplicated selectors.
50 - For shared guidance, prefer separate comments per selector rather than trailing inline notes.
51- Name CSS custom properties with the established prefixes (`--color-*`, `--space-*`, `--font-*`, …).
52 - The generator buckets them by prefix (`categorizeCSSVar`), so consistent naming keeps the documentation grouped sensibly.
53- After editing CSS docs, rebuild and review `docs/css/semantics.md` for accidental duplicates or missing selectors
54 - Adjust comments or parser thresholds before committing if the output reads awkwardly