|
| 1 | +--- |
| 2 | +name: adev-writing-guide |
| 3 | +description: Comprehensive writing guide for Angular documentation (adev). Covers Google Technical Writing standards, Angular-specific markdown extensions, code blocks, and components. Use when authoring or reviewing content in adev/src/content. |
| 4 | +--- |
| 5 | + |
| 6 | +# Angular Documentation (adev) Writing Guide |
| 7 | + |
| 8 | +This skill provides comprehensive guidelines for authoring content in `adev/src/content`. It combines Google's technical writing standards with Angular-specific markdown conventions, components, and best practices. |
| 9 | + |
| 10 | +## I. Google Technical Writing Guidelines |
| 11 | + |
| 12 | +### Tone and Content |
| 13 | + |
| 14 | +- **Be conversational and friendly:** Maintain a helpful yet professional tone. Avoid being overly casual. |
| 15 | +- **Write accessibly:** Ensure documentation is understandable to a diverse global audience, including non-native English speakers. |
| 16 | +- **Audience-first:** Focus on what the user needs to do, not just what the system does. |
| 17 | +- **Avoid pre-announcing:** Do not mention unreleased features or make unsupported claims. |
| 18 | +- **Use descriptive link text:** Link text should clearly indicate the destination (e.g., avoid "click here"). |
| 19 | + |
| 20 | +### Language and Grammar |
| 21 | + |
| 22 | +- **Use second person ("you"):** Address the reader directly. |
| 23 | +- **Prefer active voice:** Clearly state who or what is performing the action (e.g., "The system generates a token" vs "A token is generated"). |
| 24 | +- **Standard American English:** Use standard American spelling and punctuation. |
| 25 | +- **Conditional clauses first:** Place "if" or "when" clauses before the instruction (e.g., "If you encounter an error, check the logs"). |
| 26 | +- **Define terms:** Introduce new or unfamiliar terms/acronyms upon first use. |
| 27 | +- **Consistent terminology:** Use the same term for the same concept throughout the document. |
| 28 | +- **Conciseness:** Aim for one idea per sentence. Keep sentences short. |
| 29 | + |
| 30 | +### Formatting and Organization |
| 31 | + |
| 32 | +- **Sentence case for headings:** Capitalize only the first word and proper nouns in titles and headings. |
| 33 | +- **Lists:** |
| 34 | + - **Numbered lists:** Use for sequential steps or prioritized items. |
| 35 | + - **Bulleted lists:** Use for unordered collections of items. |
| 36 | + - **Description lists:** Use for term-definition pairs. |
| 37 | +- **Serial commas:** Use the Oxford comma (comma before the last item in a list of three or more). |
| 38 | +- **Code formatting:** Use code font for code-related text (filenames, variables, commands). |
| 39 | +- **UI Elements:** formatting user interface elements in **bold**. |
| 40 | +- **Date formatting:** Use unambiguous formats (e.g., "September 4, 2024" rather than "9/4/2024"). |
| 41 | +- **Structure:** Use logical hierarchy with clear introductions and navigation. Headings should be task-based where possible. |
| 42 | + |
| 43 | +### Images and Code Samples |
| 44 | + |
| 45 | +- **Images:** Use simple, clear illustrations to enhance understanding. |
| 46 | +- **Captions:** Write captions that support the image. |
| 47 | +- **Code Samples:** |
| 48 | + - Ensure code is correct and builds without errors. |
| 49 | + - Follow language-specific conventions. |
| 50 | + - **Comments:** Focus on _why_, not _what_. Avoid commenting on obvious code. |
| 51 | + |
| 52 | +### Reference Hierarchy |
| 53 | + |
| 54 | +1. Project-specific style guidelines (if any exist in `CONTRIBUTING.md` or similar). |
| 55 | +2. Google Developer Documentation Style Guide. |
| 56 | +3. Merriam-Webster (spelling). |
| 57 | +4. Chicago Manual of Style (non-technical). |
| 58 | +5. Microsoft Writing Style Guide (technical). |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## II. Angular Documentation Specifics |
| 63 | + |
| 64 | +### Code Blocks |
| 65 | + |
| 66 | +Use the appropriate language identifier for syntax highlighting: |
| 67 | + |
| 68 | +- **TypeScript (Angular):** Use `angular-ts` when TypeScript code examples contain inline templates. |
| 69 | +- **HTML (Angular):** Use `angular-html` for Angular templates. |
| 70 | +- **TypeScript (Generic):** Use `ts` for plain TypeScript. |
| 71 | +- **HTML (Generic):** Use `html` for plain HTML. |
| 72 | +- **Shell/Terminal:** Use `shell` or `bash`. |
| 73 | +- **Mermaid Diagrams:** Use `mermaid`. |
| 74 | + |
| 75 | +#### Attributes |
| 76 | + |
| 77 | +You can enhance code blocks with attributes in curly braces `{}` after the language identifier: |
| 78 | + |
| 79 | +- `header="Title"`: Adds a title to the code block. |
| 80 | +- `linenums`: Enables line numbering. |
| 81 | +- `highlight="[1, 3-5]"`: Highlights specific lines. |
| 82 | +- `hideCopy`: Hides the copy button. |
| 83 | +- `prefer`: Marks code as a preferred example (green border/check). |
| 84 | +- `avoid`: Marks code as an example to avoid (red border/cross). |
| 85 | + |
| 86 | +**Example:** |
| 87 | + |
| 88 | +````markdown |
| 89 | +```angular-ts {header:"My Component", linenums, highlight="[2]"} |
| 90 | +@Component({ |
| 91 | + selector: 'my-app', |
| 92 | + template: '<h1>Hello</h1>', |
| 93 | +}) |
| 94 | +export class App {} |
| 95 | +``` |
| 96 | +```` |
| 97 | + |
| 98 | +#### `<docs-code>` Component |
| 99 | + |
| 100 | +For more advanced code block features, use the `<docs-code>` component: |
| 101 | + |
| 102 | +- `path`: Path to a source file (e.g., `adev/src/content/examples/...`). |
| 103 | +- `header`: Custom header text. |
| 104 | +- `language`: Language identifier (e.g., `angular-ts`). |
| 105 | +- `linenums`: Boolean attribute. |
| 106 | +- `highlight`: Array of line numbers/ranges (e.g., `[[3,7], 9]`). |
| 107 | +- `diff`: Path to diff file. |
| 108 | +- `visibleLines`: Range of lines to show initially (collapsible). |
| 109 | +- `region`: Region to extract from source file. |
| 110 | +- `preview`: Boolean. Renders a live preview (StackBlitz). _Only works with standalone examples._ |
| 111 | +- `hideCode`: Boolean. Collapses code by default. |
| 112 | + |
| 113 | +**Multifile Example:** |
| 114 | + |
| 115 | +```html |
| 116 | +<docs-code-multifile path="..." preview> |
| 117 | + <docs-code path="..." /> |
| 118 | + <docs-code path="..." /> |
| 119 | +</docs-code-multifile> |
| 120 | +``` |
| 121 | + |
| 122 | +### Alerts / Admonitions |
| 123 | + |
| 124 | +Use specific keywords followed by a colon for alerts. These render as styled blocks. |
| 125 | + |
| 126 | +- `NOTE:` For ancillary information. |
| 127 | +- `TIP:` For helpful hints or shortcuts. |
| 128 | +- `IMPORTANT:` For crucial information. |
| 129 | +- `CRITICAL:` For warnings about potential data loss or severe issues. |
| 130 | +- `TODO`: For incomplete documentation. |
| 131 | +- `QUESTION:` To pose a question to the reader. |
| 132 | +- `SUMMARY:` For section summaries. |
| 133 | +- `TLDR:` For concise summaries. |
| 134 | +- `HELPFUL:` For best practices. |
| 135 | + |
| 136 | +**Example:** |
| 137 | + |
| 138 | +```markdown |
| 139 | +TIP: Use `ng serve` to run your application locally. |
| 140 | +``` |
| 141 | + |
| 142 | +### Custom Components |
| 143 | + |
| 144 | +- **Cards (`<docs-card>`):** |
| 145 | + - Must be inside `<docs-card-container>`. |
| 146 | + - Attributes: `title`, `link`, `href`. |
| 147 | +- **Callouts (`<docs-callout>`):** |
| 148 | + - Attributes: `title`, `important`, `critical`. |
| 149 | +- **Pills (`<docs-pill>`):** |
| 150 | + - Must be inside `<docs-pill-row>`. |
| 151 | + - Attributes: `title`, `href`. |
| 152 | +- **Steps / Workflow (`<docs-step>`):** |
| 153 | + - Must be inside `<docs-workflow>`. |
| 154 | + - Attributes: `title`. |
| 155 | +- **Tabs (`<docs-tab>`):** |
| 156 | + - Must be inside `<docs-tab-group>`. |
| 157 | + - Attributes: `label`. |
| 158 | +- **Videos (`<docs-video>`):** |
| 159 | + - Attributes: `src` (YouTube embed URL), `alt`. |
| 160 | + |
| 161 | +### Images |
| 162 | + |
| 163 | +Use standard markdown syntax with optional attributes for sizing and loading behavior. |
| 164 | + |
| 165 | +- `#small`, `#medium`: Append to image URL for sizing. |
| 166 | +- `{loading: 'lazy'}`: Add attribute for lazy loading. |
| 167 | + |
| 168 | +**Example:** |
| 169 | + |
| 170 | +```markdown |
| 171 | + |
| 172 | +``` |
| 173 | + |
| 174 | +### Headers |
| 175 | + |
| 176 | +- Use markdown headers (`#`, `##`, `###`). |
| 177 | +- Ensure a logical hierarchy (don't skip levels). |
| 178 | +- `h2` and `h3` are most common for content structure. |
0 commit comments