@@ -7,7 +7,7 @@ in the JSDoc format.
77** But don't worry! Even though it's embedded in your code, JSDoc is not code. It's a simple and standard
88syntax for writing documentation. You don't need to be a developer to use it.**
99
10- Before you continue, make sure ` documentation ` is on your system (do ` npm install -g documentation ` , if not installed).
10+ Before you continue, make sure ` documentation ` is on your system. (If it's not installed, run ` npm install -g documentation ` .)
1111
1212Now, let's dive in.
1313
@@ -31,7 +31,7 @@ function addOne(input) {
3131The comment before the ` addOne ` function is a JSDoc comment. Note that it
3232begins with ` /** ` instead of ` /* ` . JSDoc requires this.
3333
34- If you were to write a comment like
34+ If you were to write a comment like this:
3535
3636``` js
3737// --- INVALID - this is ignored by JSDOC ---
@@ -40,7 +40,7 @@ If you were to write a comment like
4040// @returns {number} that number, plus one.
4141```
4242
43- the comment would be ignored by ` documentation ` because it uses ` // ` syntax instead of ` /** ` .
43+ ... the comment would be ignored by ` documentation ` , because it uses ` // ` syntax instead of ` /** ` .
4444It's not valid JSDoc syntax.
4545
4646Let's break down the earlier JSDoc example:
@@ -64,8 +64,7 @@ On the second line:
6464* `{number}` is **a type**. It says that the input to this function is
6565 a JavaScript "number". It could also say `{string}`,
6666 `{Object}`, `{Date}`, or any other JavaScript built-in type. And if you
67- defined a custom class, like `FooClass`, you can use it as a type too by
68- saying `{FooClass}`.
67+ defined a custom class, like `FooClass`, you can use it as a type, too! Just say `{FooClass}`.
6968* `input` is the name of the input variable. It matches what the code
7069 says right below it (`function addOne(input)`).
7170* `any number` is the description of the input.
@@ -82,22 +81,22 @@ This is the syntax that describes an optional parameter:
8281 * @param {number} [input= 5 ] any number
8382```
8483
85- If an input is omitted, the default value of 5 will be passed to the function.
84+ If an input is omitted, the default value of `5` will be passed to the function.
8685
8786## What `documentation` does, so you don't have to
8887
8988`documentation` does some minor magic to auto-generate documentation. Unless
9089you want to read the code for yourself, here's a summary of its magic:
9190
9291**Inference**: JSDoc lets you specify absolutely everything about your code:
93- use @name to say what something is called, @kind for whether it's a function
94- or a class, @param for its parameters, and so on. But writing all of that
92+ use ` @name ` to say what something is called, ` @kind ` for whether it's a function
93+ or a class, ` @param ` for its parameters, and so on. But writing all of that
9594explicitly is tedious, so where it can, `documentation` automatically
96- populates @name , @kind , and @memberof tags based on its reading of the
95+ populates ` @name `, ` @kind ` , and ` @memberof ` tags based on its reading of the
9796code.
9897
9998**Normalization**: JSDoc has multiple words for the same thing: you can
100- say @augments or @extends and they'll do the same thing.
99+ say ` @augments ` or ` @extends ` and they'll do the same thing.
101100
102101## Development Process
103102
@@ -108,25 +107,26 @@ automated style check.
108107
109108## The Tags
110109
111- [usejsdoc.com](http://usejsdoc.org/index.html) covers all available tags in the
112- JSDoc syntax, and is a great reference. The most commonly used tags
113- are:
114-
115- * @param - input given to a function as an argument
116- * @returns - output value of a function
117- * @name - explicitly set the documented name of a function, class, or variable
118- * @private - you can use @private to document
119- code and not have it included in the generated documentation,
120- maybe it's not part of the public API. There's also @public and @protected
121- * @example - you can use the @example tag to add inline code examples with your
110+ [**`usejsdoc.com`**](http://usejsdoc.org) covers all available tags in the
111+ JSDoc syntax, and is a great reference.
112+
113+ The most commonly used tags are:
114+
115+ * `@param ` - input given to a function as an argument
116+ * `@returns ` - output value of a function
117+ * `@name ` - explicitly set the documented name of a function, class, or variable
118+ * `@private ` - you can use `@private ` to document
119+ code and not have it included in the generated documentation;
120+ maybe it's not part of the public API. There's also `@public ` and `@protected `
121+ * `@example ` - you can use the `@example ` tag to add inline code examples with your
122122 documentation
123123
124124If your text editor does not highlight JSDoc tags,
125125try [using a plugin for JSDoc](https://github.com/documentationjs/documentation/wiki/Text-editor-plugins).
126126
127127## Flow type annotations
128128
129- Alternatively, [Flow](https: // flow.org/ ) type annotations allows for a more compact syntax:
129+ Alternatively, [Flow](https://flow.org) type annotations allows for a more compact syntax:
130130
131131```js
132132/**
0 commit comments