|
| 1 | +# Style Guide |
| 2 | + |
| 3 | +* Documents are written in markdown files. |
| 4 | +* Those files should be written in **`lowercase-with-dashes.md`.** |
| 5 | + * Underscores in filenames are allowed only when they are present in the |
| 6 | + topic the document will describe (e.g., `child_process`.) |
| 7 | + * Filenames should be **lowercase**. |
| 8 | + * Some files, such as top-level markdown files, are exceptions. |
| 9 | + * Older files may use the `.markdown` extension. These may be ported to `.md` |
| 10 | + at will. **Prefer `.md` for all new documents.** |
| 11 | +* Documents should be word-wrapped at 80 characters. |
| 12 | +* The formatting described in `.editorconfig` is preferred. |
| 13 | + * A [plugin][] is available for some editors to automatically apply these rules. |
| 14 | +* Mechanical issues, like spelling and grammar, should be identified by tools, |
| 15 | + insofar as is possible. If not caught by a tool, they should be pointed out by |
| 16 | + human reviewers. |
| 17 | +* American English spelling is preferred. "Capitalize" vs. "Capitalise", |
| 18 | + "color" vs. "colour", etc. |
| 19 | +* Though controversial, the [Oxford comma][] is preferred for clarity's sake. |
| 20 | +* Generally avoid personal pronouns in reference documentation ("I", "you", |
| 21 | + "we".) |
| 22 | + * Pronouns are acceptable in more colloquial documentation, like guides. |
| 23 | + * Use **gender-neutral pronouns** and **mass nouns**. Non-comprehensive |
| 24 | + examples: |
| 25 | + * **OK**: "they", "their", "them", "folks", "people", "developers", "cats" |
| 26 | + * **NOT OK**: "his", "hers", "him", "her", "guys", "dudes". |
| 27 | +* When combining wrapping elements (parentheses and quotes), terminal |
| 28 | + punctuation should be placed: |
| 29 | + * Inside the wrapping element if the wrapping element contains a complete |
| 30 | + clause — a subject, verb, and an object. |
| 31 | + * Outside of the wrapping element if the wrapping element contains only a |
| 32 | + fragment of a clause. |
| 33 | +* Place end-of-sentence punctuation inside wrapping elements — periods go |
| 34 | + inside parentheses and quotes, not after. |
| 35 | +* Documents must start with a level-one heading. An example document will be |
| 36 | + linked here eventually. |
| 37 | +* Prefer affixing links to inlining links — prefer `[a link][]` to |
| 38 | + `[a link](http://example.com)`. |
| 39 | +* When documenting APIs, note the version the API was introduced in at |
| 40 | + the end of the section. If an API has been deprecated, also note the first |
| 41 | + version that the API appeared deprecated in. |
| 42 | +* When using dashes, use emdashes ("—", Ctrl+Alt+"-" on OSX) surrounded by |
| 43 | + spaces, per the New York Times usage. |
| 44 | +* Including assets: |
| 45 | + * If you wish to add an illustration or full program, add it to the |
| 46 | + appropriate sub-directory in the `assets/` dir. |
| 47 | + * Link to it like so: `[Asset](/assets/{subdir}/{filename})` for file-based |
| 48 | + assets, and `` for image-based assets. |
| 49 | + * For illustrations, prefer SVG to other assets. When SVG is not feasible, |
| 50 | + please keep a close eye on the filesize of the asset you're introducing. |
| 51 | +* For code blocks: |
| 52 | + * Use language aware fences. ("```js") |
| 53 | + * Code need not be complete — treat code blocks as an illustration or aid to |
| 54 | + your point, not as complete running programs. If a complete running program |
| 55 | + is necessary, include it as an asset in `assets/code-examples` and link to |
| 56 | + it. |
| 57 | +* When using underscores, asterisks and backticks please use proper escaping (**\\\_**, **\\\*** and **\\\`** instead of **\_**, **\*** and **\`**) |
| 58 | +* References to constructor functions should use PascalCase |
| 59 | +* References to constructor instances should be camelCased |
| 60 | +* References to methods should be used with parenthesis: `socket.end()` instead of `socket.end` |
| 61 | + |
| 62 | +[plugin]: http://editorconfig.org/#download |
| 63 | +[Oxford comma]: https://en.wikipedia.org/wiki/Serial_comma |
0 commit comments