-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Expand file tree
/
Copy pathSTYLE_GUIDE.md
More file actions
76 lines (74 loc) Β· 4.41 KB
/
STYLE_GUIDE.md
File metadata and controls
76 lines (74 loc) Β· 4.41 KB
Edit and raw actions
OlderNewer
Β
1
# Style Guide
2
3
* Documentation is written in markdown files with names formatted as
4
`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
* Some files, such as top-level markdown files, are exceptions.
8
* Documents should be word-wrapped at 80 characters.
9
* The formatting described in `.editorconfig` is preferred.
10
* A [plugin][] is available for some editors to automatically apply these
11
rules.
12
* Changes to documentation should be checked with `make lint-md`.
13
* American English spelling is preferred. "Capitalize" vs. "Capitalise",
14
"color" vs. "colour", etc.
15
* Use [serial commas][].
16
* Avoid personal pronouns in reference documentation ("I", "you", "we").
17
* Personal pronouns are acceptable in colloquial documentation such as guides.
18
* Use gender-neutral pronouns and gender-neutral plural nouns.
19
* OK: "they", "their", "them", "folks", "people", "developers"
20
* NOT OK: "his", "hers", "him", "her", "guys", "dudes"
21
* When combining wrapping elements (parentheses and quotes), terminal
22
punctuation should be placed:
23
* Inside the wrapping element if the wrapping element contains a complete
24
clause β a subject, verb, and an object.
25
* Outside of the wrapping element if the wrapping element contains only a
26
fragment of a clause.
27
* Place end-of-sentence punctuation inside wrapping elements β periods go
28
inside parentheses and quotes, not after.
29
* Documents must start with a level-one heading. An example document will be
30
linked here eventually.
31
* Prefer affixing links to inlining links β prefer `[a link][]` to
32
`[a link](http://example.com)`.
33
* When documenting APIs, note the version the API was introduced in at
34
the end of the section. If an API has been deprecated, also note the first
35
version that the API appeared deprecated in.
36
* When using dashes, use [Em dashes][] ("β" or `Option+Shift+"-"` on macOS)
37
surrounded by spaces, as per [The New York Times Manual of Style and Usage][].
38
* Including assets:
39
* If you wish to add an illustration or full program, add it to the
40
appropriate sub-directory in the `assets/` dir.
41
* Link to it like so: `[Asset](/assets/{subdir}/{filename})` for file-based
42
assets, and `` for image-based assets.
43
* For illustrations, prefer SVG to other assets. When SVG is not feasible,
44
please keep a close eye on the filesize of the asset you're introducing.
45
* For code blocks:
46
* Use language aware fences. ("```js")
47
* Code need not be complete β treat code blocks as an illustration or aid to
48
your point, not as complete running programs. If a complete running program
49
is necessary, include it as an asset in `assets/code-examples` and link to
50
it.
51
* When using underscores, asterisks, and backticks, please use proper escaping
52
(`\_`, `\*` and ``\` `` instead of `_`, `*` and `` ` ``).
53
* References to constructor functions should use PascalCase.
54
* References to constructor instances should use camelCase.
55
* References to methods should be used with parentheses: for example,
56
`socket.end()` instead of `socket.end`.
57
* To draw special attention to a note, adhere to the following guidelines:
58
* Make the "Note:" label italic, i.e. `*Note*:`.
59
* Use a capital letter after the "Note:" label.
60
* Preferably, make the note a new paragraph for better visual distinction.
61
* Function arguments or object properties should use the following format:
62
* <code>* \`name\` {type|type2} Optional description. \*\*Default:\*\* \`defaultValue\`</code>
63
* E.g. <code>* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`</code>
64
* The `type` should refer to a Node.js type or a [JavaScript type][]
65
* Function returns should use the following format:
66
* <code>* Returns: {type|type2} Optional description.</code>
67
* E.g. <code>* Returns: {AsyncHook} A reference to `asyncHook`.</code>
68
* Use official styling for capitalization in products and projects.
69
* OK: JavaScript, Google's V8
70
* NOT OK: Javascript, Google's v8
71
72
[Em dashes]: https://en.wikipedia.org/wiki/Dash#Em_dash
73
[Javascript type]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Data_structures_and_types
74
[serial commas]: https://en.wikipedia.org/wiki/Serial_comma
75
[The New York Times Manual of Style and Usage]: https://en.wikipedia.org/wiki/The_New_York_Times_Manual_of_Style_and_Usage
76
[plugin]: http://editorconfig.org/#download