a reactive (signals based) hypermedia web framework (wip)
stormlightlabs.github.io/volt/
hypermedia
frontend
signals
Contributing to VoltX#
Documentation#
API Doc Parser Spec#
docsCommandcurrently walks every.tsfile undersrc/and emits markdown for exported functions, interfaces, and type aliases.- Extend
parseFilebefore adding new declaration shapes so documentation stays complete.
- Extend
- When enhancing the parser:
- Normalize all leading whitespace with the
getFullTexthelpers - Prefer passing structured data (description, tags, examples) into
generateMD. - Avoid baking markdown formatting inside the extractor so the generator can evolve independently.
- Normalize all leading whitespace with the
- Preserve ordering:
parseFilevisits nodes in source order.- When adding new collectors, keep this invariant so the docs mirror the file’s story.
- Add unit coverage under
test/dev/docs-parser.test.ts(or a new spec) whenever you touch comment parsing.- Sample TS files with edge-case syntax (generics, overloads, multi-line examples) make regressions easy to catch.
- After updating comments or the parser, build new API docs and inspect the refreshed files in
docs/api/before submitting changes
Writing API Documentation (TypeScript)#
- Start each source file that ships public APIs with a
@packageDocumentationtag- Give a one-sentence summary on the first line, follow with paragraphs that explain when to reach for the module
- Avoid other tags in this block so
extractModDocscan surface clean prose (seedev/src/commands/docs.ts).
- Document every exported symbol (functions, interfaces, types, classes, consts) with a JSDoc block placed immediately above the declaration.
- Keep the first sentence under 121 characters; subsequent sentences can wrap naturally.\
- Publicly exported symbols are in entry points (
index.ts,debug.ts)
- Structure symbol docs as:
- Summary line
- Optional paragraphs
@remarksfor nuance- Any number of
@exampleblocks- Use markdown code block syntax tagged with
tsortypescript
- Use markdown code block syntax tagged with
- The parser doesn't render
@param,@returns, and@throws(as of 2025-10-20),- Fold critical argument and return-value notes into
@remarksor provide a short table in markdown - 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
- Fold critical argument and return-value notes into
- Use deliberate naming in overloads and generics; the generator flattens signatures (
extractFnSig) and shows exactly what the compiler sees.- Keep overloads minimal and consider documenting helper types separately if they deserve their own section.
Writing CSS Documentation#
- Place JSDoc-style blocks immediately above the selector or at-rule they describe.
- 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.
- See
extractCSSCommentsindev/src/commands/css-docs.ts
- See
- 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.
- Keep comments under ~180 characters or split them into multiple sentences
generateSemanticsDocscurrently (2025-10-20) discards longer blobs- Should answer:
- "What does this selector represent?"
- "Why does it exist?"
- Explain theme or state-specific overrides (
@media,[data-variant], etc.) directly in the comment so the semantics page contextualizes duplicated selectors.- For shared guidance, prefer separate comments per selector rather than trailing inline notes.
- Name CSS custom properties with the established prefixes (
--color-*,--space-*,--font-*, …).- The generator buckets them by prefix (
categorizeCSSVar), so consistent naming keeps the documentation grouped sensibly.
- The generator buckets them by prefix (
- After editing CSS docs, rebuild and review
docs/css/semantics.mdfor accidental duplicates or missing selectors- Adjust comments or parser thresholds before committing if the output reads awkwardly