|
| 1 | +--- |
| 2 | +title: "Deno Documentation Style Guide" |
| 3 | +description: "Guidelines and best practices for writing clear, consistent, and helpful documentation for the Deno runtime and ecosystem." |
| 4 | +--- |
| 5 | + |
| 6 | +This guide outlines the standards and best practices for writing documentation |
| 7 | +for Deno. Following these guidelines helps ensure our documentation remains |
| 8 | +consistent, clear, and helpful for all users. |
| 9 | + |
| 10 | +## Document Structure |
| 11 | + |
| 12 | +### Front Matter |
| 13 | + |
| 14 | +Every Markdown file should begin with front matter that includes: |
| 15 | + |
| 16 | +```yaml |
| 17 | +--- |
| 18 | +title: "Descriptive Title" |
| 19 | +description: "A concise summary (1-2 sentences) of the page content that will appear in search results and link previews." |
| 20 | +oldUrl: # Optional - used for redirects from previous documentation locations |
| 21 | +- /previous/url/path/ |
| 22 | +--- |
| 23 | +``` |
| 24 | + |
| 25 | +**Title**: Concise but descriptive, enclosed in quotes. |
| 26 | + |
| 27 | +**Description**: 1-2 sentences (140-160 characters) that summarize the page |
| 28 | +content. |
| 29 | + |
| 30 | +### Introduction paragraph |
| 31 | + |
| 32 | +Begin each document with a brief introduction that explains: |
| 33 | + |
| 34 | +- What the feature/concept is |
| 35 | +- Why it's useful |
| 36 | +- Who might need this information |
| 37 | + |
| 38 | +### Content Organization |
| 39 | + |
| 40 | +Organize content in a logical progression: |
| 41 | + |
| 42 | +1. Basic concepts first |
| 43 | +2. Common use cases |
| 44 | +3. Advanced features |
| 45 | +4. Reference information |
| 46 | + |
| 47 | +## Writing Style |
| 48 | + |
| 49 | +### Voice and Tone |
| 50 | + |
| 51 | +- **Be conversational but professional** - Write as if you're explaining to a |
| 52 | + colleague |
| 53 | +- **Use active voice** - "Deno provides..." rather than "...is provided by Deno" |
| 54 | +- **Be direct** - Address the reader as "you" |
| 55 | +- **Be concise** - Use simple sentences and avoid unnecessary words |
| 56 | + |
| 57 | +### Technical Writing Conventions |
| 58 | + |
| 59 | +- Define terms before using them |
| 60 | +- Use consistent terminology throughout the documentation |
| 61 | +- Avoid idioms and colloquialisms*that may confuse non-native English speakers |
| 62 | + |
| 63 | +### Grammar and Mechanics |
| 64 | + |
| 65 | +- Use American English spelling and conventions |
| 66 | +- Write in present tense when possible |
| 67 | +- Avoid contractions in formal explanations (use "cannot" instead of "can't") |
| 68 | +- Use sentence case for headings (capitalize only the first word and proper |
| 69 | + nouns) |
| 70 | + |
| 71 | +## Code Examples |
| 72 | + |
| 73 | +### Format |
| 74 | + |
| 75 | +- Always specify the language for syntax highlighting |
| 76 | +- For TypeScript/JavaScript, use `ts` or `js` language identifiers |
| 77 | +- Include file names when appropriate using the `title` attribute |
| 78 | + |
| 79 | +````markdown |
| 80 | +```ts title="example.ts" |
| 81 | +function greet(name: string): string { |
| 82 | + return `Hello, ${name}!`; |
| 83 | +} |
| 84 | + |
| 85 | +console.log(greet("world")); |
| 86 | +``` |
| 87 | +```` |
| 88 | + |
| 89 | +### Best Practices for Examples |
| 90 | + |
| 91 | +- Keep examples simple and focused on demonstrating one concept |
| 92 | +- Ensure all examples are functional and correct |
| 93 | +- Include comments for complex or non-obvious code sections |
| 94 | +- Show both basic and practical use cases |
| 95 | +- For longer examples, build them incrementally |
| 96 | + |
| 97 | +### Documentation Tests |
| 98 | + |
| 99 | +For code blocks that should be tested: |
| 100 | + |
| 101 | +- Ensure examples in documentation are correct and runnable |
| 102 | +- Use triple backticks with language identifiers to enable testable code blocks |
| 103 | +- Follow the guidelines in |
| 104 | + [Documentation Tests](/runtime/reference/documentation/) |
| 105 | + |
| 106 | +## Formatting Elements |
| 107 | + |
| 108 | +### Links |
| 109 | + |
| 110 | +- Use descriptive link text that makes sense out of context |
| 111 | +- For internal links, use relative paths, ending in a `/`: |
| 112 | + `/runtime/fundamentals/modules/` |
| 113 | +- Link to relevant documentation when introducing new concepts |
| 114 | + |
| 115 | +```markdown |
| 116 | +[descriptive text](/path/to/page/) |
| 117 | +``` |
| 118 | + |
| 119 | +### Lists |
| 120 | + |
| 121 | +- Use ordered lists (1., 2., 3.) for sequential steps |
| 122 | +- Use unordered lists (bullet points) for non-sequential items |
| 123 | +- Keep list items parallel in structure |
| 124 | +- Capitalize the first word of each item |
| 125 | + |
| 126 | +### Admonitions (Notes, Tips, Warnings) |
| 127 | + |
| 128 | +Use admonitions sparingly to highlight important information: |
| 129 | + |
| 130 | +```markdown |
| 131 | +:::note Important supplementary information. ::: |
| 132 | + |
| 133 | +:::tip Helpful advice for better usage. ::: |
| 134 | + |
| 135 | +:::caution Warn about potential issues or gotchas. ::: |
| 136 | +``` |
| 137 | + |
| 138 | +### Tables |
| 139 | + |
| 140 | +Use tables for presenting structured data: |
| 141 | + |
| 142 | +```markdown |
| 143 | +| Header 1 | Header 2 | |
| 144 | +| -------- | -------- | |
| 145 | +| Cell 1 | Cell 2 | |
| 146 | +| Cell 3 | Cell 4 | |
| 147 | +``` |
| 148 | + |
| 149 | +## Specific Content Types |
| 150 | + |
| 151 | +### Command Reference |
| 152 | + |
| 153 | +When documenting CLI commands: |
| 154 | + |
| 155 | +- Begin with a clear description of what the command does |
| 156 | +- List all available flags and options |
| 157 | +- Include examples showing common usage patterns |
| 158 | +- When possible, show expected output |
| 159 | + |
| 160 | +### API Documentation |
| 161 | + |
| 162 | +For API documentation: |
| 163 | + |
| 164 | +- Clearly define parameters and return values |
| 165 | +- Specify types for all parameters |
| 166 | +- Provide examples for common use cases |
| 167 | +- Document potential errors or exceptions |
| 168 | + |
| 169 | +### Tutorials |
| 170 | + |
| 171 | +For tutorial-style documentation: |
| 172 | + |
| 173 | +- Begin with prerequisites and what will be learned |
| 174 | +- Break down into clear, numbered steps |
| 175 | +- Provide complete code examples |
| 176 | +- Explain the "why" behind each step, not just the "how" |
| 177 | +- End with next steps or related resources |
| 178 | + |
| 179 | +## Visual Elements |
| 180 | + |
| 181 | +### Screenshots and Images |
| 182 | + |
| 183 | +- Include alt text for all images |
| 184 | +- Keep images up to date with the current UI |
| 185 | +- Crop images to focus on relevant parts |
| 186 | +- Use annotations to highlight important areas |
| 187 | +- Ensure images are clear at different screen sizes |
| 188 | + |
| 189 | +### Diagrams |
| 190 | + |
| 191 | +- Use diagrams to explain complex concepts or flows |
| 192 | +- Keep diagrams simple and focused on the key message |
| 193 | +- Include text explanations that complement the diagram |
| 194 | + |
| 195 | +## Inclusive Language |
| 196 | + |
| 197 | +- Use gender-neutral language |
| 198 | +- Avoid terminology with problematic historical connotations |
| 199 | +- Be mindful of global audiences and avoid culture-specific references |
| 200 | +- Follow the |
| 201 | + [inclusive code guidelines](https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/inclusive_code.md) |
| 202 | + |
| 203 | +## Review Process |
| 204 | + |
| 205 | +Before submitting documentation: |
| 206 | + |
| 207 | +1. Verify technical accuracy |
| 208 | +2. Check for clarity and readability |
| 209 | +3. Ensure consistent formatting |
| 210 | +4. Validate all links |
| 211 | +5. Test all code examples |
| 212 | +6. Review for typos and grammatical errors |
| 213 | + |
| 214 | +## File Organization |
| 215 | + |
| 216 | +- Place new files in the appropriate directory based on content type |
| 217 | +- Use lowercase for filenames with words separated by underscores (e.g., |
| 218 | + `setup_environment.md`) |
| 219 | +- Follow the existing navigation structure when adding new pages |
0 commit comments