mirror of https://github.com/nodejs/node.git
doc: add blanks around code fences
Addresses Markdownlint MD031 rule warnings PR-URL: https://github.com/nodejs/node/pull/29366 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com>
This commit is contained in:
parent
ee8f02b0d7
commit
9ab1e07774
|
@ -665,16 +665,19 @@ during configuration if the ICU version is too old.
|
||||||
#### Unix/macOS
|
#### Unix/macOS
|
||||||
|
|
||||||
From an already-unpacked ICU:
|
From an already-unpacked ICU:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu
|
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu
|
||||||
```
|
```
|
||||||
|
|
||||||
From a local ICU tarball:
|
From a local ICU tarball:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz
|
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz
|
||||||
```
|
```
|
||||||
|
|
||||||
From a tarball URL:
|
From a tarball URL:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ ./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz
|
$ ./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz
|
||||||
```
|
```
|
||||||
|
|
|
@ -185,6 +185,7 @@ class FancyContainer {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Memory Management
|
## Memory Management
|
||||||
|
|
||||||
### Memory allocation
|
### Memory allocation
|
||||||
|
|
|
@ -168,6 +168,7 @@ generated output. The `command` string passed to the exec function is processed
|
||||||
directly by the shell and special characters (vary based on
|
directly by the shell and special characters (vary based on
|
||||||
[shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
|
[shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
|
||||||
need to be dealt with accordingly:
|
need to be dealt with accordingly:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exec('"/path/to/test file/test.sh" arg1 arg2');
|
exec('"/path/to/test file/test.sh" arg1 arg2');
|
||||||
// Double quotes are used so that the space in the path is not interpreted as
|
// Double quotes are used so that the space in the path is not interpreted as
|
||||||
|
|
|
@ -70,6 +70,7 @@ added: v10.12.0
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Print source-able bash completion script for Node.js.
|
Print source-able bash completion script for Node.js.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ node --completion-bash > node_bash_completion
|
$ node --completion-bash > node_bash_completion
|
||||||
$ source node_bash_completion
|
$ source node_bash_completion
|
||||||
|
|
|
@ -498,6 +498,7 @@ This method does not display anything unless used in the inspector. The
|
||||||
`console.profile()` method starts a JavaScript CPU profile with an optional
|
`console.profile()` method starts a JavaScript CPU profile with an optional
|
||||||
label until [`console.profileEnd()`][] is called. The profile is then added to
|
label until [`console.profileEnd()`][] is called. The profile is then added to
|
||||||
the **Profile** panel of the inspector.
|
the **Profile** panel of the inspector.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
console.profile('MyLabel');
|
console.profile('MyLabel');
|
||||||
// Some code
|
// Some code
|
||||||
|
|
|
@ -716,6 +716,7 @@ const dh = crypto.createDiffieHellmanGroup(name);
|
||||||
```
|
```
|
||||||
|
|
||||||
`name` is taken from [RFC 2412][] (modp1 and 2) and [RFC 3526][]:
|
`name` is taken from [RFC 2412][] (modp1 and 2) and [RFC 3526][]:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h
|
$ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h
|
||||||
modp1 # 768 bits
|
modp1 # 768 bits
|
||||||
|
|
|
@ -528,6 +528,7 @@ socket.bind(1234, () => {
|
||||||
|
|
||||||
#### Example: IPv4 Outgoing Multicast Interface
|
#### Example: IPv4 Outgoing Multicast Interface
|
||||||
All systems use an IP of the host on the desired physical interface:
|
All systems use an IP of the host on the desired physical interface:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const socket = dgram.createSocket('udp4');
|
const socket = dgram.createSocket('udp4');
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ Errors that occur within _Asynchronous APIs_ may be reported in multiple ways:
|
||||||
// Otherwise handle the data
|
// Otherwise handle the data
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
- When an asynchronous method is called on an object that is an
|
- When an asynchronous method is called on an object that is an
|
||||||
[`EventEmitter`][], errors can be routed to that object's `'error'` event.
|
[`EventEmitter`][], errors can be routed to that object's `'error'` event.
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,7 @@ module via `import`.
|
||||||
"main": "./src/index.js"
|
"main": "./src/index.js"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// ./my-app.mjs
|
// ./my-app.mjs
|
||||||
|
|
||||||
|
|
|
@ -231,6 +231,7 @@ fs.readFileSync(new URL('file:///p/a/t/h/%2f'));
|
||||||
/* TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must not include encoded
|
/* TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must not include encoded
|
||||||
/ characters */
|
/ characters */
|
||||||
```
|
```
|
||||||
|
|
||||||
On Windows, `file:` URLs having encoded backslash will result in a throw:
|
On Windows, `file:` URLs having encoded backslash will result in a throw:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -3815,6 +3816,7 @@ recommended.
|
||||||
|
|
||||||
When `file` is a file descriptor, the behavior is almost identical to directly
|
When `file` is a file descriptor, the behavior is almost identical to directly
|
||||||
calling `fs.write()` like:
|
calling `fs.write()` like:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
fs.write(fd, Buffer.from(data, options.encoding), callback);
|
fs.write(fd, Buffer.from(data, options.encoding), callback);
|
||||||
```
|
```
|
||||||
|
|
|
@ -2459,6 +2459,7 @@ The `CONNECT` method is used to allow an HTTP/2 server to be used as a proxy
|
||||||
for TCP/IP connections.
|
for TCP/IP connections.
|
||||||
|
|
||||||
A simple TCP Server:
|
A simple TCP Server:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
|
|
||||||
|
|
|
@ -255,6 +255,7 @@ req.on('error', (e) => {
|
||||||
});
|
});
|
||||||
req.end();
|
req.end();
|
||||||
```
|
```
|
||||||
|
|
||||||
Example using options from [`tls.connect()`][]:
|
Example using options from [`tls.connect()`][]:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
174
doc/api/n-api.md
174
doc/api/n-api.md
File diff suppressed because it is too large
Load Diff
|
@ -299,6 +299,7 @@ obs.observe({ entryTypes: ['mark'], buffered: true });
|
||||||
|
|
||||||
performance.mark('test');
|
performance.mark('test');
|
||||||
```
|
```
|
||||||
|
|
||||||
Because `PerformanceObserver` instances introduce their own additional
|
Because `PerformanceObserver` instances introduce their own additional
|
||||||
performance overhead, instances should not be left subscribed to notifications
|
performance overhead, instances should not be left subscribed to notifications
|
||||||
indefinitely. Users should disconnect observers as soon as they are no
|
indefinitely. Users should disconnect observers as soon as they are no
|
||||||
|
|
|
@ -760,6 +760,7 @@ process.
|
||||||
```js
|
```js
|
||||||
console.log(`Current directory: ${process.cwd()}`);
|
console.log(`Current directory: ${process.cwd()}`);
|
||||||
```
|
```
|
||||||
|
|
||||||
## process.debugPort
|
## process.debugPort
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.7.2
|
added: v0.7.2
|
||||||
|
@ -771,6 +772,7 @@ The port used by Node.js's debugger when enabled.
|
||||||
```js
|
```js
|
||||||
process.debugPort = 5858;
|
process.debugPort = 5858;
|
||||||
```
|
```
|
||||||
|
|
||||||
## process.disconnect()
|
## process.disconnect()
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.7.2
|
added: v0.7.2
|
||||||
|
@ -2199,6 +2201,7 @@ To check if a stream is connected to a [TTY][] context, check the `isTTY`
|
||||||
property.
|
property.
|
||||||
|
|
||||||
For instance:
|
For instance:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ node -p "Boolean(process.stdin.isTTY)"
|
$ node -p "Boolean(process.stdin.isTTY)"
|
||||||
true
|
true
|
||||||
|
|
|
@ -1026,6 +1026,7 @@ const writable = fs.createWriteStream('file.txt');
|
||||||
// All the data from readable goes into 'file.txt'.
|
// All the data from readable goes into 'file.txt'.
|
||||||
readable.pipe(writable);
|
readable.pipe(writable);
|
||||||
```
|
```
|
||||||
|
|
||||||
It is possible to attach multiple `Writable` streams to a single `Readable`
|
It is possible to attach multiple `Writable` streams to a single `Readable`
|
||||||
stream.
|
stream.
|
||||||
|
|
||||||
|
|
|
@ -950,6 +950,7 @@ For EC keys, the following properties may be defined:
|
||||||
`'P-256'`.
|
`'P-256'`.
|
||||||
|
|
||||||
Example certificate:
|
Example certificate:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
{ subject:
|
{ subject:
|
||||||
{ OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ],
|
{ OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ],
|
||||||
|
|
|
@ -101,6 +101,7 @@ where `3245` is the process id. If it is not run with that
|
||||||
environment variable set, then it will not print anything.
|
environment variable set, then it will not print anything.
|
||||||
|
|
||||||
The `section` supports wildcard also:
|
The `section` supports wildcard also:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const debuglog = util.debuglog('foo-bar');
|
const debuglog = util.debuglog('foo-bar');
|
||||||
|
@ -110,6 +111,7 @@ debuglog('hi there, it\'s foo-bar [%d]', 2333);
|
||||||
|
|
||||||
if it is run with `NODE_DEBUG=foo*` in the environment, then it will output
|
if it is run with `NODE_DEBUG=foo*` in the environment, then it will output
|
||||||
something like:
|
something like:
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
FOO-BAR 3257: hi there, it's foo-bar [2333]
|
FOO-BAR 3257: hi there, it's foo-bar [2333]
|
||||||
```
|
```
|
||||||
|
@ -889,6 +891,7 @@ doSomething[util.promisify.custom] = (foo) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
If `promisify.custom` is defined but is not a function, `promisify()` will
|
If `promisify.custom` is defined but is not a function, `promisify()` will
|
||||||
throw an error.
|
throw an error.
|
||||||
|
|
||||||
|
|
|
@ -557,6 +557,7 @@ Module Record][]s in the ECMAScript specification.
|
||||||
import foo from 'foo';
|
import foo from 'foo';
|
||||||
// ^^^^^ the module specifier
|
// ^^^^^ the module specifier
|
||||||
```
|
```
|
||||||
|
|
||||||
* `referencingModule` {vm.SourceTextModule} The `Module` object `link()` is
|
* `referencingModule` {vm.SourceTextModule} The `Module` object `link()` is
|
||||||
called on.
|
called on.
|
||||||
* Returns: {vm.SourceTextModule|Promise}
|
* Returns: {vm.SourceTextModule|Promise}
|
||||||
|
|
|
@ -230,6 +230,7 @@ quality, but can be useful when data needs to be available as soon as possible.
|
||||||
|
|
||||||
In the following example, `flush()` is used to write a compressed partial
|
In the following example, `flush()` is used to write a compressed partial
|
||||||
HTTP response to the client:
|
HTTP response to the client:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const zlib = require('zlib');
|
const zlib = require('zlib');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
|
|
|
@ -29,6 +29,7 @@ version in the [tag list][].
|
||||||
2. Update `certdata.txt` from the NSS release tag.
|
2. Update `certdata.txt` from the NSS release tag.
|
||||||
|
|
||||||
Update the tag in the commands below, and run:
|
Update the tag in the commands below, and run:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cd tools/
|
cd tools/
|
||||||
./mk-ca-bundle.pl -v 2>_before
|
./mk-ca-bundle.pl -v 2>_before
|
||||||
|
@ -63,6 +64,7 @@ Run the command below:
|
||||||
Confirm that `../src/node_root_certs.h` was updated.
|
Confirm that `../src/node_root_certs.h` was updated.
|
||||||
|
|
||||||
Determine what changes were made by diffing the before and after files:
|
Determine what changes were made by diffing the before and after files:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
% diff _before _after
|
% diff _before _after
|
||||||
11d10
|
11d10
|
||||||
|
@ -91,6 +93,7 @@ Determine what changes were made by diffing the before and after files:
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the diff to update the message below, and commit `src/node_root_certs.h`:
|
Use the diff to update the message below, and commit `src/node_root_certs.h`:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
crypto: update root certificates
|
crypto: update root certificates
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,7 @@ const server = http.createServer(common.mustCall((req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Countdown Module
|
#### Countdown Module
|
||||||
|
|
||||||
The common [Countdown module](https://github.com/nodejs/node/tree/master/test/common#countdown-module)
|
The common [Countdown module](https://github.com/nodejs/node/tree/master/test/common#countdown-module)
|
||||||
|
@ -401,11 +402,13 @@ $ make cctest
|
||||||
```
|
```
|
||||||
|
|
||||||
A filter can be applied to run single/multiple test cases:
|
A filter can be applied to run single/multiple test cases:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ make cctest GTEST_FILTER=EnvironmentTest.AtExitWithArgument
|
$ make cctest GTEST_FILTER=EnvironmentTest.AtExitWithArgument
|
||||||
```
|
```
|
||||||
|
|
||||||
`cctest` can also be run directly which can be useful when debugging:
|
`cctest` can also be run directly which can be useful when debugging:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ out/Release/cctest --gtest_filter=EnvironmentTest.AtExit*
|
$ out/Release/cctest --gtest_filter=EnvironmentTest.AtExit*
|
||||||
```
|
```
|
||||||
|
|
|
@ -34,6 +34,7 @@ request.
|
||||||
they pass, **probably** minor or patch
|
they pass, **probably** minor or patch
|
||||||
* A breaking change helper
|
* A breaking change helper
|
||||||
([full source](https://gist.github.com/chrisdickinson/ba532fa0e4e243fb7b44)):
|
([full source](https://gist.github.com/chrisdickinson/ba532fa0e4e243fb7b44)):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
SHOW=$(git show-ref -d $(git describe --abbrev=0) | tail -n1 | awk '{print $1}')
|
SHOW=$(git show-ref -d $(git describe --abbrev=0) | tail -n1 | awk '{print $1}')
|
||||||
git checkout $(git show -s --pretty='%T' $SHOW) -- test
|
git checkout $(git show -s --pretty='%T' $SHOW) -- test
|
||||||
|
|
Loading…
Reference in New Issue