Skip to content

Commit

Permalink
doc: harmonize fenced code snippet flags
Browse files Browse the repository at this point in the history
We had a few code snippets that were using a non-descriptive tag (e.g.
`console` or `text`), whereas the actual language it's using describes
it better, and improves the syntax highlighting. This commit also
removes non-necessary leading chars (e.g. `$`, `>`, or `%`) to make it
easier for readers to copy and paste to try the command themselves.

PR-URL: #48082
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
aduh95 committed May 21, 2023
1 parent 66fbe7f commit 260092e
Show file tree
Hide file tree
Showing 23 changed files with 381 additions and 381 deletions.
196 changes: 98 additions & 98 deletions BUILDING.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ files.

To download `SHASUMS256.txt` using `curl`:

```console
$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt
```bash
curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt
```

To check that a downloaded file matches the checksum, run
it through `sha256sum` with a command such as:

```console
$ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c -
```bash
grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c -
```

For Current and LTS, the GPG detached signature of `SHASUMS256.txt` is in
Expand All @@ -115,16 +115,16 @@ For Current and LTS, the GPG detached signature of `SHASUMS256.txt` is in
[the GPG keys of individuals authorized to create releases](#release-keys). To
import the keys:

```console
$ gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
```bash
gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
```

See [Release keys](#release-keys) for a script to import active release keys.

Next, download the `SHASUMS256.txt.sig` for the release:

```console
$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt.sig
```bash
curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt.sig
```

Then use `gpg --verify SHASUMS256.txt.sig SHASUMS256.txt` to verify
Expand Down
4 changes: 2 additions & 2 deletions doc/api/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ filename to the `sources` array:
Once the `binding.gyp` file is ready, the example addons can be configured and
built using `node-gyp`:

```console
$ node-gyp configure build
```bash
node-gyp configure build
```

### Function arguments
Expand Down
30 changes: 15 additions & 15 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ Error: Access to this API has been restricted

The process needs to have access to the `index.js` module:

```console
$ node --experimental-permission --allow-fs-read=/path/to/index.js index.js
```bash
node --experimental-permission --allow-fs-read=/path/to/index.js index.js
```

### `--allow-fs-write`
Expand Down Expand Up @@ -314,9 +314,9 @@ added: v10.12.0

Print source-able bash completion script for Node.js.

```console
$ node --completion-bash > node_bash_completion
$ source node_bash_completion
```bash
node --completion-bash > node_bash_completion
source node_bash_completion
```

### `-C condition`, `--conditions=condition`
Expand All @@ -339,8 +339,8 @@ The default Node.js conditions of `"node"`, `"default"`, `"import"`, and

For example, to run a module with "development" resolutions:

```console
$ node -C development app.js
```bash
node -C development app.js
```

### `--cpu-prof`
Expand Down Expand Up @@ -1854,8 +1854,8 @@ Use `--watch-path` to specify what paths to watch.
This flag cannot be combined with
`--check`, `--eval`, `--interactive`, or the REPL.

```console
$ node --watch index.js
```bash
node --watch index.js
```

### `--watch-path`
Expand All @@ -1877,8 +1877,8 @@ combination with `--watch`.
This flag cannot be combined with
`--check`, `--eval`, `--interactive`, `--test`, or the REPL.

```console
$ node --watch-path=./src --watch-path=./tests index.js
```bash
node --watch-path=./src --watch-path=./tests index.js
```

This option is only supported on macOS and Windows.
Expand All @@ -1889,8 +1889,8 @@ when the option is used on a platform that does not support it.

Disable the clearing of the console when watch mode restarts the process.

```console
$ node --watch --watch-preserve-output test.js
```bash
node --watch --watch-preserve-output test.js
```

### `--zero-fill-buffers`
Expand Down Expand Up @@ -2525,8 +2525,8 @@ garbage collection in an effort to free unused memory.
On a machine with 2 GiB of memory, consider setting this to
1536 (1.5 GiB) to leave some memory for other uses and avoid swapping.

```console
$ node --max-old-space-size=1536 index.js
```bash
node --max-old-space-size=1536 index.js
```

### `--max-semi-space-size=SIZE` (in megabytes)
Expand Down
2 changes: 1 addition & 1 deletion doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ all `import` calls. They won't apply to `require` calls; those still follow
Loaders follow the pattern of `--require`:
```console
```bash
node \
--experimental-loader unpkg \
--experimental-loader http-to-https \
Expand Down
8 changes: 4 additions & 4 deletions doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -1616,8 +1616,8 @@ server.listen(8124, () => {

Test this by using `telnet`:

```console
$ telnet localhost 8124
```bash
telnet localhost 8124
```

To listen on the socket `/tmp/echo.sock`:
Expand All @@ -1630,8 +1630,8 @@ server.listen('/tmp/echo.sock', () => {

Use `nc` to connect to a Unix domain socket server:

```console
$ nc -U /tmp/echo.sock
```bash
nc -U /tmp/echo.sock
```

## `net.getDefaultAutoSelectFamily()`
Expand Down
12 changes: 6 additions & 6 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -922,8 +922,8 @@ argv.forEach((val, index) => {

Launching the Node.js process as:

```console
$ node process-args.js one two=three four
```bash
node process-args.js one two=three four
```

Would generate the output:
Expand Down Expand Up @@ -1577,8 +1577,8 @@ reflected outside the Node.js process, or (unless explicitly requested)
to other [`Worker`][] threads.
In other words, the following example would not work:
```console
$ node -e 'process.env.foo = "bar"' && echo $foo
```bash
node -e 'process.env.foo = "bar"' && echo $foo
```
While the following will:
Expand Down Expand Up @@ -1683,8 +1683,8 @@ include the Node.js executable, the name of the script, or any options following
the script name. These options are useful in order to spawn child processes with
the same execution environment as the parent.
```console
$ node --harmony script.js --version
```bash
node --harmony script.js --version
```
Results in `process.execArgv`:
Expand Down
2 changes: 1 addition & 1 deletion doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ terminal settings, which will allow use with `rlwrap`.

For example, the following can be added to a `.bashrc` file:

```text
```bash
alias node="env NODE_NO_READLINE=1 rlwrap node"
```

Expand Down
52 changes: 26 additions & 26 deletions doc/api/single-executable-applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,42 @@ Here are the steps for creating a single executable application using one such
tool, [postject][]:

1. Create a JavaScript file:
```console
$ echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
```bash
echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
```

2. Create a configuration file building a blob that can be injected into the
single executable application (see
[Generating single executable preparation blobs][] for details):
```console
$ echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json
```bash
echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json
```

3. Generate the blob to be injected:
```console
$ node --experimental-sea-config sea-config.json
```bash
node --experimental-sea-config sea-config.json
```

4. Create a copy of the `node` executable and name it according to your needs:

* On systems other than Windows:

```console
$ cp $(command -v node) hello
```bash
cp $(command -v node) hello
```

* On Windows:

Using PowerShell:

```console
$ cp (Get-Command node).Source hello.exe
```bash
cp (Get-Command node).Source hello.exe
```

Using Command Prompt:

```console
$ for /F "tokens=*" %n IN ('where.exe node') DO @(copy "%n" hello.exe)
```bash
for /F "tokens=*" %n IN ('where.exe node') DO @(copy "%n" hello.exe)
```

The `.exe` extension is necessary.
Expand All @@ -70,17 +70,17 @@ tool, [postject][]:

* On macOS:

```console
$ codesign --remove-signature hello
```bash
codesign --remove-signature hello
```

* On Windows (optional):

[signtool][] can be used from the installed [Windows SDK][]. If this step is
skipped, ignore any signature-related warning from postject.

```console
$ signtool remove /s hello.exe
```bash
signtool remove /s hello.exe
```

6. Inject the blob into the copied binary by running `postject` with
Expand All @@ -100,20 +100,20 @@ tool, [postject][]:
To summarize, here is the required command for each platform:

* On Linux:
```console
$ npx postject hello NODE_SEA_BLOB sea-prep.blob \
```bash
npx postject hello NODE_SEA_BLOB sea-prep.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
```

* On Windows:
```console
$ npx postject hello.exe NODE_SEA_BLOB sea-prep.blob \
```bash
npx postject hello.exe NODE_SEA_BLOB sea-prep.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
```

* On macOS:
```console
$ npx postject hello NODE_SEA_BLOB sea-prep.blob \
```bash
npx postject hello NODE_SEA_BLOB sea-prep.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
--macho-segment-name NODE_SEA
```
Expand All @@ -122,17 +122,17 @@ tool, [postject][]:

* On macOS:

```console
$ codesign --sign - hello
```bash
codesign --sign - hello
```

* On Windows (optional):

A certificate needs to be present for this to work. However, the unsigned
binary would still be runnable.

```console
$ signtool sign /fd SHA256 hello.exe
```bash
signtool sign /fd SHA256 hello.exe
```

8. Run the binary:
Expand Down
22 changes: 11 additions & 11 deletions doc/api/synopsis.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ Now, create an empty project folder called `projects`, then navigate into it.

Linux and Mac:

```console
$ mkdir ~/projects
$ cd ~/projects
```bash
mkdir ~/projects
cd ~/projects
```

Windows CMD:

```console
> mkdir %USERPROFILE%\projects
> cd %USERPROFILE%\projects
```powershell
mkdir %USERPROFILE%\projects
cd %USERPROFILE%\projects
```

Windows PowerShell:

```console
> mkdir $env:USERPROFILE\projects
> cd $env:USERPROFILE\projects
```powershell
mkdir $env:USERPROFILE\projects
cd $env:USERPROFILE\projects
```

Next, create a new source file in the `projects`
Expand Down Expand Up @@ -73,8 +73,8 @@ server.listen(port, hostname, () => {

Save the file, go back to the terminal window, and enter the following command:

```console
$ node hello-world.js
```bash
node hello-world.js
```

Output like this should appear in the terminal:
Expand Down
4 changes: 2 additions & 2 deletions doc/api/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ failures, it is easy to not notice unnecessarily poor TLS performance. The
OpenSSL CLI can be used to verify that servers are resuming sessions. Use the
`-reconnect` option to `openssl s_client`, for example:

```console
$ openssl s_client -connect localhost:443 -reconnect
```bash
openssl s_client -connect localhost:443 -reconnect
```

Read through the debug output. The first connection should say "New", for
Expand Down
4 changes: 2 additions & 2 deletions doc/api/wasi.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ To run the above example, create a new WebAssembly text format file named

Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`

```console
$ wat2wasm demo.wat
```bash
wat2wasm demo.wat
```

## Class: `WASI`
Expand Down
Loading

0 comments on commit 260092e

Please sign in to comment.