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
|
||||
|
||||
From an already-unpacked ICU:
|
||||
|
||||
```console
|
||||
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu
|
||||
```
|
||||
|
||||
From a local ICU tarball:
|
||||
|
||||
```console
|
||||
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz
|
||||
```
|
||||
|
||||
From a tarball URL:
|
||||
|
||||
```console
|
||||
$ ./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz
|
||||
```
|
||||
|
|
|
@ -185,6 +185,7 @@ class FancyContainer {
|
|||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Memory Management
|
||||
|
||||
### 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
|
||||
[shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
|
||||
need to be dealt with accordingly:
|
||||
|
||||
```js
|
||||
exec('"/path/to/test file/test.sh" arg1 arg2');
|
||||
// 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.
|
||||
|
||||
```console
|
||||
$ node --completion-bash > 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
|
||||
label until [`console.profileEnd()`][] is called. The profile is then added to
|
||||
the **Profile** panel of the inspector.
|
||||
|
||||
```js
|
||||
console.profile('MyLabel');
|
||||
// Some code
|
||||
|
|
|
@ -716,6 +716,7 @@ const dh = crypto.createDiffieHellmanGroup(name);
|
|||
```
|
||||
|
||||
`name` is taken from [RFC 2412][] (modp1 and 2) and [RFC 3526][]:
|
||||
|
||||
```console
|
||||
$ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h
|
||||
modp1 # 768 bits
|
||||
|
|
|
@ -528,6 +528,7 @@ socket.bind(1234, () => {
|
|||
|
||||
#### Example: IPv4 Outgoing Multicast Interface
|
||||
All systems use an IP of the host on the desired physical interface:
|
||||
|
||||
```js
|
||||
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
|
||||
});
|
||||
```
|
||||
|
||||
- When an asynchronous method is called on an object that is an
|
||||
[`EventEmitter`][], errors can be routed to that object's `'error'` event.
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@ module via `import`.
|
|||
"main": "./src/index.js"
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
// ./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
|
||||
/ characters */
|
||||
```
|
||||
|
||||
On Windows, `file:` URLs having encoded backslash will result in a throw:
|
||||
|
||||
```js
|
||||
|
@ -3815,6 +3816,7 @@ recommended.
|
|||
|
||||
When `file` is a file descriptor, the behavior is almost identical to directly
|
||||
calling `fs.write()` like:
|
||||
|
||||
```javascript
|
||||
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.
|
||||
|
||||
A simple TCP Server:
|
||||
|
||||
```js
|
||||
const net = require('net');
|
||||
|
||||
|
|
|
@ -255,6 +255,7 @@ req.on('error', (e) => {
|
|||
});
|
||||
req.end();
|
||||
```
|
||||
|
||||
Example using options from [`tls.connect()`][]:
|
||||
|
||||
```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');
|
||||
```
|
||||
|
||||
Because `PerformanceObserver` instances introduce their own additional
|
||||
performance overhead, instances should not be left subscribed to notifications
|
||||
indefinitely. Users should disconnect observers as soon as they are no
|
||||
|
|
|
@ -760,6 +760,7 @@ process.
|
|||
```js
|
||||
console.log(`Current directory: ${process.cwd()}`);
|
||||
```
|
||||
|
||||
## process.debugPort
|
||||
<!-- YAML
|
||||
added: v0.7.2
|
||||
|
@ -771,6 +772,7 @@ The port used by Node.js's debugger when enabled.
|
|||
```js
|
||||
process.debugPort = 5858;
|
||||
```
|
||||
|
||||
## process.disconnect()
|
||||
<!-- YAML
|
||||
added: v0.7.2
|
||||
|
@ -2199,6 +2201,7 @@ To check if a stream is connected to a [TTY][] context, check the `isTTY`
|
|||
property.
|
||||
|
||||
For instance:
|
||||
|
||||
```console
|
||||
$ node -p "Boolean(process.stdin.isTTY)"
|
||||
true
|
||||
|
|
|
@ -1026,6 +1026,7 @@ const writable = fs.createWriteStream('file.txt');
|
|||
// All the data from readable goes into 'file.txt'.
|
||||
readable.pipe(writable);
|
||||
```
|
||||
|
||||
It is possible to attach multiple `Writable` streams to a single `Readable`
|
||||
stream.
|
||||
|
||||
|
|
|
@ -950,6 +950,7 @@ For EC keys, the following properties may be defined:
|
|||
`'P-256'`.
|
||||
|
||||
Example certificate:
|
||||
|
||||
```text
|
||||
{ subject:
|
||||
{ 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.
|
||||
|
||||
The `section` supports wildcard also:
|
||||
|
||||
```js
|
||||
const util = require('util');
|
||||
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
|
||||
something like:
|
||||
|
||||
```txt
|
||||
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
|
||||
throw an error.
|
||||
|
||||
|
|
|
@ -557,6 +557,7 @@ Module Record][]s in the ECMAScript specification.
|
|||
import foo from 'foo';
|
||||
// ^^^^^ the module specifier
|
||||
```
|
||||
|
||||
* `referencingModule` {vm.SourceTextModule} The `Module` object `link()` is
|
||||
called on.
|
||||
* 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
|
||||
HTTP response to the client:
|
||||
|
||||
```js
|
||||
const zlib = require('zlib');
|
||||
const http = require('http');
|
||||
|
|
|
@ -29,6 +29,7 @@ version in the [tag list][].
|
|||
2. Update `certdata.txt` from the NSS release tag.
|
||||
|
||||
Update the tag in the commands below, and run:
|
||||
|
||||
```shell
|
||||
cd tools/
|
||||
./mk-ca-bundle.pl -v 2>_before
|
||||
|
@ -63,6 +64,7 @@ Run the command below:
|
|||
Confirm that `../src/node_root_certs.h` was updated.
|
||||
|
||||
Determine what changes were made by diffing the before and after files:
|
||||
|
||||
```shell
|
||||
% diff _before _after
|
||||
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`:
|
||||
|
||||
```text
|
||||
crypto: update root certificates
|
||||
|
||||
|
|
|
@ -205,6 +205,7 @@ const server = http.createServer(common.mustCall((req, res) => {
|
|||
});
|
||||
|
||||
```
|
||||
|
||||
#### 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:
|
||||
|
||||
```console
|
||||
$ make cctest GTEST_FILTER=EnvironmentTest.AtExitWithArgument
|
||||
```
|
||||
|
||||
`cctest` can also be run directly which can be useful when debugging:
|
||||
|
||||
```console
|
||||
$ out/Release/cctest --gtest_filter=EnvironmentTest.AtExit*
|
||||
```
|
||||
|
|
|
@ -34,11 +34,12 @@ request.
|
|||
they pass, **probably** minor or patch
|
||||
* A breaking change helper
|
||||
([full source](https://gist.github.com/chrisdickinson/ba532fa0e4e243fb7b44)):
|
||||
```sh
|
||||
SHOW=$(git show-ref -d $(git describe --abbrev=0) | tail -n1 | awk '{print $1}')
|
||||
git checkout $(git show -s --pretty='%T' $SHOW) -- test
|
||||
make -j4 test
|
||||
```
|
||||
|
||||
```sh
|
||||
SHOW=$(git show-ref -d $(git describe --abbrev=0) | tail -n1 | awk '{print $1}')
|
||||
git checkout $(git show -s --pretty='%T' $SHOW) -- test
|
||||
make -j4 test
|
||||
```
|
||||
|
||||
### LTS/Version labels
|
||||
|
||||
|
|
Loading…
Reference in New Issue