|
| 1 | +# Documentation style guide |
| 2 | + |
| 3 | +Use this reference when writing or editing docs in this repository. |
| 4 | + |
| 5 | +## Core principles |
| 6 | + |
| 7 | +- Use progressive disclosure: start simple, add complexity only when needed. |
| 8 | +- Build examples step by step; do not jump to the final solution. |
| 9 | +- Start with a naive implementation, call out its problems, then refactor and layer features. |
| 10 | +- Provide full code context but highlight only the lines that matter. |
| 11 | +- Keep tone consistent and direct. Use second person. Avoid emojis and colloquial phrasing. |
| 12 | +- For each feature or API, lead with: what it does, why it is useful, then an example. |
| 13 | +- Separate guides from API reference. Keep the distinction explicit in headings or sections. |
| 14 | + |
| 15 | +## Example structure for a guide section |
| 16 | + |
| 17 | +1. What it does (one or two sentences). |
| 18 | +2. Why it is useful (intent-driven use cases). |
| 19 | +3. Naive example (minimal, working). |
| 20 | +4. Limitations of the naive approach. |
| 21 | +5. Improved approach (refactor). |
| 22 | +6. Add features one at a time (each with a short explanation). |
| 23 | + |
| 24 | +## Code sample emphasis |
| 25 | + |
| 26 | +Use Starlight line highlighting so the reader can see the change without losing context. You may highlight lines in a standalone example, or use `ins` for additive examples: |
| 27 | + |
| 28 | +```mdx |
| 29 | +```ts {3-4} |
| 30 | +import { thing } from "@pkg"; |
| 31 | + |
| 32 | +const value = thing(); |
| 33 | +``` |
| 34 | +``` |
| 35 | + |
| 36 | +Use `ins` and `del` consistently when showing refactors: |
| 37 | + |
| 38 | +```mdx |
| 39 | +```ts del={2} ins={3} |
| 40 | +const value = oldThing(); |
| 41 | +const value = newThing(); |
| 42 | +``` |
| 43 | +``` |
| 44 | + |
| 45 | +## Consistent language |
| 46 | + |
| 47 | +- Use second person ("you can", "you should", "you might"). |
| 48 | +- Use consistent terms for functions and signatures (e.g., always write `foo()` with parentheses). |
| 49 | +- Keep headings and callouts neutral and descriptive. |
| 50 | + |
| 51 | +## Where docs live |
| 52 | + |
| 53 | +- Guides live in `www/src/content/docs/` and are written in MDX for Starlight. |
| 54 | +- API reference can be a section in a guide or a separate doc collection, but keep the separation explicit. |
0 commit comments