Skip to content
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: update synopsis, toc, other nits #6167

Merged
merged 3 commits into from
Apr 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion doc/api/_toc.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@// NB(chrisdickinson): if you move this file, be sure to update tools/doc/html.js to
@// point at the new location.
* [About these Docs](documentation.html)
* [Synopsis](synopsis.html)
* [Usage & Example](synopsis.html)

<div class="line"></div>

* [Assertion Testing](assert.html)
* [Buffer](buffer.html)
* [C/C++ Addons](addons.html)
Expand Down Expand Up @@ -39,3 +42,8 @@
* [V8](v8.html)
* [VM](vm.html)
* [ZLIB](zlib.html)

<div class="line"></div>

* [GitHub Repo & Issue Tracker](https://github.com/nodejs/node)
* [Mailing List](http://groups.google.com/group/nodejs)
30 changes: 22 additions & 8 deletions doc/api/synopsis.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
# Synopsis
# Usage

<!--type=misc-->

`node [options] [v8 options] [script.js | -e "script"] [arguments]`

Please see the [Command Line Options][] document for information about
different options and ways to run scripts with Node.

## Example

An example of a [web server][] written with Node.js which responds with
`'Hello World'`:

```js
const http = require('http');

http.createServer( (request, response) => {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124);
const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});

console.log('Server running at http://127.0.0.1:8124/');
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
```

To run the server, put the code into a file called `example.js` and execute
it with the node program
it with Node.js:

```
$ node example.js
Server running at http://127.0.0.1:8124/
Server running at http://127.0.0.1:3000/
```

All of the examples in the documentation can be run similarly.

[Command Line Options]: cli.html#cli_command_line_options
[web server]: http.html
31 changes: 30 additions & 1 deletion doc/api_assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ em code {
font-size: .8em;
}

.line {
width: calc(100% - 1em);
display: block;
padding-bottom: 1px;
}

.api_stability {
color: white !important;
margin: 0 0 1em 0;
Expand Down Expand Up @@ -207,6 +213,12 @@ header h1 {
padding-top: 1em;
}

#apicontent .line {
width: calc(50% - 1em);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: calc is discouraged for portability and preformance, no? If copy paste then defer this for some later time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calc() has been supported across the board for a good while: http://caniuse.com/#feat=calc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was something about it resulting in more and multiple passes during reflow, but I think that is outdated. Scratch the above then. Thx

margin: 1em 1em .95em;
background-color: #ccc;
}

#toc + h1 {
margin-top: 1em;
padding-top: 0;
Expand Down Expand Up @@ -388,17 +400,34 @@ a code {

#column2 ul {
list-style: none;
margin: 1.25em 0;
margin: .9em 0 .5em;
background: #333;
}

#column2 > :first-child {
margin: 1.25em 1em;
}

#column2 > ul:nth-child(2) {
margin: 1.25em 0 .5em;
}

#column2 > ul:last-child {
margin: .9em 0 1.25em;
}

#column2 ul li {
padding-left: 1.4em;
margin-bottom: .5em;
padding-bottom: .5em;
font-size: .8em;
}

#column2 .line {
margin: 0 .5em;
background-color: #707070;
}

#column2 ul li:last-child {
margin-bottom: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div id="column2" class="interior">
<div id="intro" class="interior">
<a href="/" title="Go back to the home page">
Node.js (1)
Node.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more appropriate to be NODE(1).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nm. wasn't paying attention to what file this was located in. our man page should be NODE(1), but this looks good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our man page is NODE(1) since I rewrote it. :P

</a>
</div>
__GTOC__
Expand Down