-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc : being more explicit in the synopsis #17977
Conversation
Assuming less knowledge on the part of the reader, making it easier to get start using Node.js.
doc/api/synopsis.md
Outdated
|
||
Next, create a new source file in the `projects` folder and call it `hello_world.js`. | ||
|
||
If you’re using more than one word in your filename, use an underscore(`_`) to separate them for simplicity and avoid using the space character in file names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "use an underscore (_
) or a hyphen (-
)"? Some style guides and practices (including Node.js repository) prefer hyphens, so we can mention both here.
doc/api/synopsis.md
Outdated
`'Hello World'`: | ||
`'Hello World!'`: | ||
|
||
Firstly, Make sure you have downloaded Node.js from [Node.js Official website](http://nodejs.org/#download). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make -> make?
doc/api/synopsis.md
Outdated
`'Hello World!'`: | ||
|
||
Firstly, Make sure you have downloaded Node.js from [Node.js Official website](http://nodejs.org/#download). | ||
Then, Follow this [installation guide](https://nodejs.org/en/download/package-manager/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow -> follow?
doc/api/synopsis.md
Outdated
Then, Follow this [installation guide](https://nodejs.org/en/download/package-manager/). | ||
|
||
|
||
Now, Create an empty project folder called `projects`, navigate into it: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create -> create?
doc/api/synopsis.md
Outdated
|
||
If you’re using more than one word in your filename, use an underscore(`_`) to separate them for simplicity and avoid using the space character in file names. | ||
|
||
For example, you’d use `hello_world.js` rather than `hello world.js`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually do not use personal pronouns in the docs, but this guide is a less formal one, so I am not sure if this is OK. Let's see what others think.
doc/api/synopsis.md
Outdated
For example, you’d use `hello_world.js` rather than `hello world.js`. | ||
Node.js files always end with the `.js` extension. | ||
|
||
open `hello_world.js` in your favorite text editor and paste in the following content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open -> Open?
doc/api/synopsis.md
Outdated
|
||
To run the server, put the code into a file called `example.js` and execute | ||
it with Node.js: | ||
Save the file, and go back to your terminal window enter the following command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Save the file, go back to your terminal window and enter?
doc/api/synopsis.md
Outdated
``` | ||
Your should see an output like this in your terminal to indicate Node.js server is running: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your -> you? (If pronouns are considered appropriate).
doc/api/synopsis.md
Outdated
```javascript | ||
Server running at http://127.0.0.1:3000/ | ||
```` | ||
Now, Open your favorite browser and visit `http://127.0.0.1:3000`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open ->open?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some nits, but let's see what native speakers think.
Thank you!
I think it's fine here, this is directly addressed to the user "How you can run these code samples". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good
doc/api/synopsis.md
Outdated
`'Hello World!'`: | ||
|
||
Firstly, Make sure you have downloaded Node.js from [Node.js Official website](http://nodejs.org/#download). | ||
Then, Follow this [installation guide](https://nodejs.org/en/download/package-manager/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change:
Then, Follow this
to
If you want to install Node using a package manager, see [this guide]
If people are just getting started with Node they probably don't need to know about package managers.
doc/api/synopsis.md
Outdated
Now, Create an empty project folder called `projects`, navigate into it: | ||
|
||
Linux and Mac: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you include something like this:
We’ll be showing off a number of commands using a terminal, and those lines all start with $. You don’t need to type in the $ character; they are there to indicate the start of each command. You’ll see many tutorials and examples around the web that follow this convention: $ for commands run as a regular user, and # for commands you should be running as an administrator. Lines that don’t start with $ are typically showing the output of the previous command.
(taken from https://doc.rust-lang.org/book/second-edition/ch01-01-installation.html#installation, feel free to reword it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gibfahn Note my previous comments about personal pronouns. I wonder if this should really be a guide so that we don't have to worry about that sort of thing. Link to it from the docs?
doc/api/synopsis.md
Outdated
Then, Follow this [installation guide](https://nodejs.org/en/download/package-manager/). | ||
|
||
|
||
Now, Create an empty project folder called `projects`, navigate into it: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you tweak this to make it clear that projects
is just an example name, not one that has any significance (i.e. you don't have to call it projects
)
Maybe:
If you aren't sure where to put your code, a good place to start is to create a
projects
folder in your home directory like so:
(
I took inspiration from the rust book again, specifically here:
First, make a directory to put your Rust code in. Rust doesn’t care where your code lives, but for this book, we’d suggest making a projects directory in your home directory and keeping all your projects there. Open a terminal and enter the following commands to make a directory for this particular project:
https://doc.rust-lang.org/book/second-edition/ch01-02-hello-world.html#creating-a-project-directory
)
doc/api/synopsis.md
Outdated
`'Hello World!'`: | ||
|
||
Firstly, make sure you have downloaded Node.js from [Node.js Official website](http://nodejs.org/#download). | ||
Then, follow this [installation guide](https://nodejs.org/en/download/package-manager/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change:
Then, Follow this
to
If you want to install Node using a package manager, see [this guide]
If people are just getting started with Node they probably don't need to know about package managers.
doc/api/synopsis.md
Outdated
Now, create an empty project folder called `projects`, navigate into it: | ||
|
||
Linux and Mac: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you include something like this:
We’ll be showing off a number of commands using a terminal, and those lines all start with $. You don’t need to type in the $ character; they are there to indicate the start of each command. You’ll see many tutorials and examples around the web that follow this convention: $ for commands run as a regular user, and # for commands you should be running as an administrator. Lines that don’t start with $ are typically showing the output of the previous command.
(taken from https://doc.rust-lang.org/book/second-edition/ch01-01-installation.html#installation, feel free to reword it).
doc/api/synopsis.md
Outdated
|
||
Next, create a new source file in the `projects` folder and call it `hello-world.js`. | ||
|
||
If you’re using more than one word in your filename, use an hyphen (`-`) or an underscore(`_`) to separate them for simplicity and avoid using the space character in file names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap lines at 80 chars?
doc/api/synopsis.md
Outdated
``` | ||
you should see an output like this in your terminal to indicate Node.js server is running: | ||
```javascript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove the javascript
here.
doc/api/synopsis.md
Outdated
Then, follow this [installation guide](https://nodejs.org/en/download/package-manager/). | ||
|
||
|
||
Now, create an empty project folder called `projects`, navigate into it: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make it more clear that your folder doesn't have to be called projects
? Maybe:
Create a directory to put your code in, for example to create a
projects
folder in your home directory you can run these commands in a terminal:
@the-wazz could you let us know whether this is clear for you? |
doc/api/synopsis.md
Outdated
|
||
Now, create an empty project folder called `projects`, navigate into it: | ||
|
||
Linux and Mac: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be UNIX rather than Linux and Mac ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually go with POSIX
but people might not know what that means. UNIX
is technically incorrect because that refers to a specific trademarked operating system. UNIX-like
is often used instead. Maybe Unix/macOS
to conform with BUILDING.md even though I don't like that personally. This gets tricky. Maybe leave it as Linux and Mac
after all. :-D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc/api> grep -i "UNIX" * | wc -l
40
We seem to be using UNIX
abundantly to refer UNIX-like systems.
If we use Linux and MAC, it leaves an impression of either:
- Only Linux and MAC are supported
- The example holds good only for Linux and MAC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gireeshpunathil I'm convinced. Let's go with UNIX
(or Unix
or UNIX-like
) and consolidating terminology/typography across documents can happen some other time. Certainly "Linux and macOS" would explicitly exclude (for example) AIX which certainly is incorrect in this case.
doc/api/synopsis.md
Outdated
|
||
they are there to indicate the start of each command. | ||
|
||
You’ll see many tutorials and examples around the web that follow this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Micro-nit (non-blocking, ignore if you disagree): remove around the web
doc/api/synopsis.md
Outdated
`'Hello World!'`: | ||
|
||
We’ll be displaying a number of commands using a terminal, and those lines | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs are usually single-spaced. I'm not sure that double-spacing like this will render the same as other docs. Probably best to single-space it. (Blank lines between paragraphs are 👍 though!)
I almost feel bad leaving this comment, but since this is a doc and not an informal guide, we try to avoid personal pronouns like you (although I'm sure there are many examples where we don't manage to avoid it). If you can re-word some or all of it, it might fit the tone of other docs better. For example, instead of:
...maybe more like this?:
|
(By the way, the personal pronoun thing and a bunch of other rules/guidelines can be found at https://github.com/nodejs/node/blob/master/doc/STYLE_GUIDE.md.) |
doc/api/synopsis.md
Outdated
|
||
and call it `hello-world.js`. | ||
|
||
If you’re using more than one word in your filename, use an hyphen (`-`) or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/an hyphen/a hyphen/
Wow! You managed to get rid of all the personal pronouns. I'm kind of amazed. :-D |
|
||
Commands displayed in this document are shown starting with `$` or `>` | ||
to replicate how they would appear in a user's terminal. | ||
Do not include the `$` and `>` character they are there to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Period after character
.
Thanks for doing this! |
doc/api/synopsis.md
Outdated
Lines that don’t start with `$` or `>` character are typically showing | ||
the output of the previous command. | ||
|
||
Firstly, make sure to have downloaded Node.js from [Node.js Official website](http://nodejs.org/#download). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the link itself down to the end of the document
doc/api/synopsis.md
Outdated
``` | ||
an output like this should appear in the terminal to indicate Node.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/an/An
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. Besides that LG.
doc/api/synopsis.md
Outdated
|
||
To install Node using a package manager, see [this guide][]. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: multiple lines are actually going to be shown as a single line in the output. The same applies to line 67.
doc/api/synopsis.md
Outdated
Lines that don’t start with `$` or `>` character are typically showing | ||
the output of the previous command. | ||
|
||
Firstly, make sure to have downloaded Node.js from [Node.js Official website][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally do not like to recommend the regular download as it makes it more difficult for the user to switch to a new version. Therefore I would prefer to directly reference the guide.
It could be written as e.g.:
Firstly, make sure to have downloaded and installed Node.js. See [this guide][] for further install information.
doc/api/synopsis.md
Outdated
|
||
Many of the examples in the documentation can be run similarly. | ||
|
||
[Command Line Options]: cli.html#cli_command_line_options | ||
[web server]: http.html | ||
[this guide]:https://nodejs.org/en/download/package-manager/ | ||
[Node.js Official website]:http://nodejs.org/#download |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a empty space after the colon.
doc/api/synopsis.md
Outdated
$ mkdir ~/projects | ||
$ cd ~/projects | ||
``` | ||
Windows CMD: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is always good to have a blank line before and after code / markdown blocks etc.
doc/api/synopsis.md
Outdated
the space character in file names. | ||
|
||
For example, use `hello-world.js` rather than `hello world.js`. | ||
Node.js files always end with the `.js` extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally do not feel like this limitation should be enforced, no matter that it is good style. The point for me would be to educate the user by telling why and that is missing here.
So instead of these two paragraphs I would write e.g.:
In Node.js it is considered good style to use hypens (`-`) or underscores (`_`) to separate
multiple words in filenames.
Besides that not only Node.js files end with .js
but any JavaScript file. Is that part really necessary to be documented?
doc/api/synopsis.md
Outdated
}); | ||
|
||
server.listen(port, hostname, () => { | ||
console.log(`Server running at http://${hostname}:${port}/`); | ||
}); | ||
``` | ||
Save the file, go back to the terminal window enter the following command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: As above: a blank line before and after code blocks is always good. There are more of these cases below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with the last two open comments fixed.
doc/api/synopsis.md
Outdated
Next, create a new source file in the `projects` folder | ||
and call it `hello-world.js`. | ||
|
||
In Node.js it is considered good style to use hyphens (`-`) or underscores (`_`) to separate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this exceeds 80 characters.
It would be nice to address @Trott s comment while landing. |
Assuming less knowledge on the part of the reader, making it easier to get start using Node.js. PR-URL: nodejs#17977 Fixes: nodejs#17970, Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Landed in 4ac7be9 🎉 |
Assuming less knowledge on the part of the reader, making it easier to get start using Node.js. PR-URL: #17977 Fixes: #17970, Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Assuming less knowledge on the part of the reader, making it easier to get start using Node.js. PR-URL: #17977 Fixes: #17970, Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Assuming less knowledge on the part of the reader, making it easier to get start using Node.js. PR-URL: #17977 Fixes: #17970, Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Assuming less knowledge on the part of the reader, making it easier to get start using Node.js. PR-URL: #17977 Fixes: #17970, Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Assuming less knowledge on the part of the reader, making it easier to get start using Node.js. PR-URL: #17977 Fixes: #17970, Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Assuming less knowledge on the part of the reader, making it easier to get start using Node.js. PR-URL: nodejs#17977 Fixes: nodejs#17970, Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Assuming less knowledge on the part of the reader, making it easier to for starters.
Fixes: #17970, nodejs/help#1049
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
fs