Skip to content

Commit 7bd728e

Browse files
benglrvagg
authored andcommitted
doc: consistent reference-style links
Moved all the URLs in API docs to the bottom of the files as reference-style links. PR-URL: #3845 Reviewed-By: James M Snell <[email protected]>
1 parent bc52cd5 commit 7bd728e

28 files changed

+371
-309
lines changed

doc/api/addons.markdown

+18-15
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ knowledge of several libraries:
77
- V8 JavaScript, a C++ library. Used for interfacing with JavaScript:
88
creating objects, calling functions, etc. Documented mostly in the
99
`v8.h` header file (`deps/v8/include/v8.h` in the Node.js source
10-
tree), which is also available
11-
[online](https://v8docs.nodesource.com/).
10+
tree), which is also available [online][].
1211

13-
- [libuv](https://github.com/libuv/libuv), C event loop library.
14-
Anytime one needs to wait for a file descriptor to become readable,
15-
wait for a timer, or wait for a signal to be received one will need
16-
to interface with libuv. That is, if you perform any I/O, libuv will
17-
need to be used.
12+
- [libuv][], C event loop library. Anytime one needs to wait for a file
13+
descriptor to become readable, wait for a timer, or wait for a signal
14+
to be received one will need to interface with libuv. That is, if you
15+
perform any I/O, libuv will need to be used.
1816

1917
- Internal Node.js libraries. Most importantly is the `node::ObjectWrap`
2018
class which you will likely want to derive from.
@@ -25,9 +23,8 @@ Node.js statically compiles all its dependencies into the executable.
2523
When compiling your module, you don't need to worry about linking to
2624
any of these libraries.
2725

28-
All of the following examples are available for
29-
[download](https://github.com/rvagg/node-addon-examples) and may be
30-
used as a starting-point for your own Addon.
26+
All of the following examples are available for [download][] and may
27+
be used as a starting-point for your own Addon.
3128

3229
## Hello world
3330

@@ -77,7 +74,7 @@ The `module_name` needs to match the filename of the final binary (minus the
7774
The source code needs to be built into `addon.node`, the binary Addon. To
7875
do this we create a file called `binding.gyp` which describes the configuration
7976
to build your module in a JSON-like format. This file gets compiled by
80-
[node-gyp](https://github.com/nodejs/node-gyp).
77+
[node-gyp][].
8178

8279
{
8380
"targets": [
@@ -113,10 +110,9 @@ Please see patterns below for further information or
113110
## Addon patterns
114111

115112
Below are some addon patterns to help you get started. Consult the online
116-
[v8 reference](http://izs.me/v8-docs/main.html) for help with the various v8
117-
calls, and v8's [Embedder's Guide](http://code.google.com/apis/v8/embed.html)
118-
for an explanation of several concepts used such as handles, scopes,
119-
function templates, etc.
113+
[v8 reference][] for help with the various v8 calls, and v8's
114+
[Embedder's Guide][] for an explanation of several concepts used such as
115+
handles, scopes, function templates, etc.
120116

121117
In order to use these examples you need to compile them using `node-gyp`.
122118
Create the following `binding.gyp` file:
@@ -869,3 +865,10 @@ Test in JavaScript by running:
869865

870866
// test.js
871867
var addon = require('./build/Release/addon');
868+
869+
[online]: https://v8docs.nodesource.com/
870+
[libuv]: https://github.com/libuv/libuv
871+
[download]: https://github.com/rvagg/node-addon-examples
872+
[node-gyp]: https://github.com/nodejs/node-gyp
873+
[v8 reference]: http://izs.me/v8-docs/main.html
874+
[Embedder's Guide]: http://code.google.com/apis/v8/embed.html

doc/api/assert.markdown

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ operator ( `===` ).
3232

3333
## assert.doesNotThrow(block[, error][, message])
3434

35-
Expects `block` not to throw an error. See [assert.throws()](#assert_assert_throws_block_error_message) for more details.
35+
Expects `block` not to throw an error. See [assert.throws()][] for more details.
3636

3737
If `block` throws an error and if it is of a different type from `error`, the
3838
thrown error will get propagated back to the caller. The following call will
@@ -128,3 +128,5 @@ Custom error validation:
128128
},
129129
"unexpected error"
130130
);
131+
132+
[assert.throws()]: #assert_assert_throws_block_error_message

doc/api/buffer.markdown

+8-7
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ Example:
114114
* `buf1` {Buffer}
115115
* `buf2` {Buffer}
116116

117-
The same as [`buf1.compare(buf2)`](#buffer_buf_compare_otherbuffer). Useful
118-
for sorting an Array of Buffers:
117+
The same as [`buf1.compare(buf2)`][]. Useful for sorting an Array of Buffers:
119118

120119
var arr = [Buffer('1234'), Buffer('0123')];
121120
arr.sort(Buffer.compare);
@@ -287,11 +286,10 @@ buffer.
287286
* `byteOffset` Number, Optional, Default: 0
288287
* Return: Number
289288

290-
Operates similar to
291-
[Array#indexOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf).
292-
Accepts a String, Buffer or Number. Strings are interpreted as UTF8. Buffers
293-
will use the entire buffer. So in order to compare a partial Buffer use
294-
`Buffer#slice()`. Numbers can range from 0 to 255.
289+
Operates similar to [Array#indexOf()][]. Accepts a String, Buffer or Number.
290+
Strings are interpreted as UTF8. Buffers will use the entire buffer. So in order
291+
to compare a partial Buffer use `Buffer#slice()`. Numbers can range from 0 to
292+
255.
295293

296294
### buf.length
297295

@@ -932,3 +930,6 @@ un-pooled Buffer instance using SlowBuffer and copy out the relevant bits.
932930

933931
Though this should be used sparingly and only be a last resort *after* a developer
934932
has actively observed undue memory retention in their applications.
933+
934+
[`buf1.compare(buf2)`]: #buffer_buf_compare_otherbuffer
935+
[Array#indexOf()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf

doc/api/child_process.markdown

+29-22
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ data you send to the child process may not be immediately consumed.)
1212

1313
To create a child process use `require('child_process').spawn()` or
1414
`require('child_process').fork()`. The semantics of each are slightly
15-
different, and explained [below](#child_process_asynchronous_process_creation).
15+
different, and explained [below][].
1616

17-
For scripting purposes you may find the
18-
[synchronous counterparts](#child_process_synchronous_process_creation) more
17+
For scripting purposes you may find the [synchronous counterparts][] more
1918
convenient.
2019

2120
## Class: ChildProcess
@@ -61,8 +60,7 @@ Note that the `exit`-event may or may not fire after an error has occurred. If
6160
you are listening on both events to fire a function, remember to guard against
6261
calling your function twice.
6362

64-
See also [`ChildProcess#kill()`](#child_process_child_kill_signal) and
65-
[`ChildProcess#send()`](#child_process_child_send_message_sendhandle_callback).
63+
See also [`ChildProcess#kill()`][] and [`ChildProcess#send()`][].
6664

6765
### Event: 'exit'
6866

@@ -161,7 +159,7 @@ Example:
161159
* `callback` {Function}
162160
* Return: Boolean
163161

164-
When using [`child_process.fork()`](#child_process_child_process_fork_modulepath_args_options) you can write to the child using
162+
When using [`child_process.fork()`][] you can write to the child using
165163
`child.send(message[, sendHandle][, callback])` and messages are received by
166164
a `'message'` event on the child.
167165

@@ -309,9 +307,7 @@ to the same object, or null.
309307
* {Array}
310308

311309
A sparse array of pipes to the child process, corresponding with positions in
312-
the [stdio](#child_process_options_stdio) option to
313-
[spawn](#child_process_child_process_spawn_command_args_options) that have been
314-
set to `'pipe'`.
310+
the [stdio][] option to [spawn][] that have been set to `'pipe'`.
315311
Note that streams 0-2 are also available as ChildProcess.stdin,
316312
ChildProcess.stdout, and ChildProcess.stderr, respectively.
317313

@@ -438,9 +434,9 @@ the existing process and uses a shell to execute the command.*
438434
* `stderr` {Buffer}
439435
* Return: ChildProcess object
440436

441-
This is similar to [`child_process.exec()`](#child_process_child_process_exec_command_options_callback) except it does not execute a
437+
This is similar to [`child_process.exec()`][] except it does not execute a
442438
subshell but rather the specified file directly. This makes it slightly
443-
leaner than [`child_process.exec()`](#child_process_child_process_exec_command_options_callback). It has the same options.
439+
leaner than [`child_process.exec()`][]. It has the same options.
444440

445441

446442
### child_process.fork(modulePath[, args][, options])
@@ -461,10 +457,10 @@ leaner than [`child_process.exec()`](#child_process_child_process_exec_command_o
461457
* `gid` {Number} Sets the group identity of the process. (See setgid(2).)
462458
* Return: ChildProcess object
463459

464-
This is a special case of the [`child_process.spawn()`](#child_process_child_process_spawn_command_args_options) functionality for spawning Node.js
465-
processes. In addition to having all the methods in a normal ChildProcess
466-
instance, the returned object has a communication channel built-in. See
467-
[`child.send(message, [sendHandle])`](#child_process_child_send_message_sendhandle_callback) for details.
460+
This is a special case of the [`child_process.spawn()`][] functionality for
461+
spawning Node.js processes. In addition to having all the methods in a normal
462+
ChildProcess instance, the returned object has a communication channel built-in.
463+
See [`child.send(message, [sendHandle])`][] for details.
468464

469465
These child Node.js processes are still whole new instances of V8. Assume at
470466
least 30ms startup and 10mb memory for each new Node.js. That is, you cannot
@@ -662,7 +658,7 @@ Example:
662658
// startd-style interface.
663659
spawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] });
664660

665-
See also: [`child_process.exec()`](#child_process_child_process_exec_command_options_callback) and [`child_process.fork()`](#child_process_child_process_fork_modulepath_args_options)
661+
See also: [`child_process.exec()`][] and [`child_process.fork()`][]
666662

667663
## Synchronous Process Creation
668664

@@ -702,11 +698,7 @@ process has exited.
702698

703699
If the process times out, or has a non-zero exit code, this method ***will***
704700
throw. The `Error` object will contain the entire result from
705-
[`child_process.spawnSync()`](#child_process_child_process_spawnsync_command_args_options)
706-
707-
[EventEmitter]: events.html#events_class_events_eventemitter
708-
[net.Server]: net.html#net_class_net_server
709-
[net.Socket]: net.html#net_class_net_socket
701+
[`child_process.spawnSync()`][]
710702

711703
### child_process.execSync(command[, options])
712704

@@ -740,7 +732,7 @@ process has exited.
740732

741733
If the process times out, or has a non-zero exit code, this method ***will***
742734
throw. The `Error` object will contain the entire result from
743-
[`child_process.spawnSync()`](#child_process_child_process_spawnsync_command_args_options)
735+
[`child_process.spawnSync()`][]
744736

745737
### child_process.spawnSync(command[, args][, options])
746738

@@ -773,3 +765,18 @@ timeout has been encountered and `killSignal` is sent, the method won't return
773765
until the process has completely exited. That is to say, if the process handles
774766
the `SIGTERM` signal and doesn't exit, your process will wait until the child
775767
process has exited.
768+
769+
[below]: #child_process_asynchronous_process_creation
770+
[synchronous counterparts]: #child_process_synchronous_process_creation
771+
[EventEmitter]: events.html#events_class_events_eventemitter
772+
[`ChildProcess#kill()`]: #child_process_child_kill_signal
773+
[`ChildProcess#send()`]: #child_process_child_send_message_sendhandle_callback
774+
[net.Server]: net.html#net_class_net_server
775+
[net.Socket]: net.html#net_class_net_socket
776+
[`child_process.fork()`]: #child_process_child_process_fork_modulepath_args_options
777+
[stdio]: #child_process_options_stdio
778+
[spawn]: #child_process_child_process_spawn_command_args_options
779+
[`child_process.exec()`]: #child_process_child_process_exec_command_options_callback
780+
[`child_process.spawn()`]: #child_process_child_process_spawn_command_args_options
781+
[`child.send(message, [sendHandle])`]: #child_process_child_send_message_sendhandle_callback
782+
[`child_process.spawnSync()`]: #child_process_child_process_spawnsync_command_args_options

doc/api/cluster.markdown

+15-11
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ This event is the same as the one provided by `child_process.fork()`.
123123

124124
In a worker you can also use `process.on('error')`.
125125

126-
[ChildProcess.send()]: child_process.html#child_process_child_send_message_sendhandle_callback
127-
128126
### Event: 'exit'
129127

130128
* `code` {Number} the exit code, if it exited normally.
@@ -232,15 +230,15 @@ Causes `.suicide` to be set.
232230
Note that after a server is closed, it will no longer accept new connections,
233231
but connections may be accepted by any other listening worker. Existing
234232
connections will be allowed to close as usual. When no more connections exist,
235-
see [server.close()](net.html#net_event_close), the IPC channel to the worker
236-
will close allowing it to die gracefully.
233+
see [server.close()][], the IPC channel to the worker will close allowing it to
234+
die gracefully.
237235

238236
The above applies *only* to server connections, client connections are not
239237
automatically closed by workers, and disconnect does not wait for them to close
240238
before exiting.
241239

242240
Note that in a worker, `process.disconnect` exists, but it is not this function,
243-
it is [disconnect](child_process.html#child_process_child_disconnect).
241+
it is [disconnect][].
244242

245243
Because long living server connections may block workers from disconnecting, it
246244
may be useful to send a message, so application specific actions may be taken to
@@ -313,7 +311,7 @@ Causes `.suicide` to be set.
313311
This method is aliased as `worker.destroy()` for backwards compatibility.
314312

315313
Note that in a worker, `process.kill()` exists, but it is not this function,
316-
it is [kill](process.html#process_process_kill_pid_signal).
314+
it is [kill][].
317315

318316
### worker.process
319317

@@ -323,8 +321,7 @@ All workers are created using `child_process.fork()`, the returned object
323321
from this function is stored as `.process`. In a worker, the global `process`
324322
is stored.
325323

326-
See: [Child Process module](
327-
child_process.html#child_process_child_process_fork_modulepath_args_options)
324+
See: [Child Process module][]
328325

329326
Note that workers will call `process.exit(0)` if the `'disconnect'` event occurs
330327
on `process` and `.suicide` is not `true`. This protects against accidental
@@ -408,7 +405,7 @@ This can be used to restart the worker by calling `.fork()` again.
408405
cluster.fork();
409406
});
410407

411-
See [child_process event: 'exit'](child_process.html#child_process_event_exit).
408+
See [child_process event: 'exit'][].
412409

413410
## Event: 'fork'
414411

@@ -464,8 +461,7 @@ The `addressType` is one of:
464461

465462
Emitted when any worker receives a message.
466463

467-
See
468-
[child_process event: 'message'](child_process.html#child_process_event_message).
464+
See [child_process event: 'message'][].
469465

470466
## Event: 'online'
471467

@@ -647,3 +643,11 @@ the worker's unique id is the easiest way to find the worker.
647643
socket.on('data', function(id) {
648644
var worker = cluster.workers[id];
649645
});
646+
647+
[server.close()]: net.html#net_event_close
648+
[disconnect]: child_process.html#child_process_child_disconnect
649+
[kill]: process.html#process_process_kill_pid_signal
650+
[Child Process module]: child_process.html#child_process_child_process_fork_modulepath_args_options
651+
[ChildProcess.send()]: child_process.html#child_process_child_send_message_sendhandle_callback
652+
[child_process event: 'exit']: child_process.html#child_process_event_exit
653+
[child_process event: 'message']: child_process.html#child_process_event_message.

doc/api/console.markdown

+8-6
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ The global `console` is a special `Console` whose output is sent to
4343

4444
new Console(process.stdout, process.stderr);
4545

46-
[assert.ok()]: assert.html#assert_assert_value_message_assert_ok_value_message
47-
[util.format()]: util.html#util_util_format_format
48-
[customizing util.inspect colors]: util.html#util_customizing_util_inspect_colors
49-
5046
## console
5147

5248
* {Object}
@@ -114,13 +110,13 @@ is used on each argument. See [util.format()][] for more information.
114110
Used to calculate the duration of a specific operation. To start a timer, call
115111
the `console.time()` method, giving it a name as only parameter. To stop the
116112
timer, and to get the elapsed time in milliseconds, just call the
117-
[`console.timeEnd()`](#console_console_timeend_label) method, again passing the
113+
[`console.timeEnd()`][] method, again passing the
118114
timer's name as the parameter.
119115

120116
### console.timeEnd(label)
121117

122118
Stops a timer that was previously started by calling
123-
[`console.time()`](#console_console_time_label) and print the result to the
119+
[`console.time()`][] and prints the result to the
124120
console.
125121

126122
Example:
@@ -140,3 +136,9 @@ to the current position.
140136
### console.warn([data][, ...])
141137

142138
Same as `console.error`.
139+
140+
[assert.ok()]: assert.html#assert_assert_value_message_assert_ok_value_message
141+
[customizing util.inspect colors]: util.html#util_customizing_util_inspect_colors
142+
[util.format()]: util.html#util_util_format_format
143+
[`console.timeEnd()`]: #console_console_timeend_label
144+
[`console.time()`]: #console_console_time_label

0 commit comments

Comments
 (0)