Skip to content

Commit 260092e

Browse files
committed
doc: harmonize fenced code snippet flags
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]>
1 parent 66fbe7f commit 260092e

23 files changed

+381
-381
lines changed

BUILDING.md

Lines changed: 98 additions & 98 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ files.
9898

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

101-
```console
102-
$ curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt
101+
```bash
102+
curl -O https://nodejs.org/dist/vx.y.z/SHASUMS256.txt
103103
```
104104

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

108-
```console
109-
$ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c -
108+
```bash
109+
grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c -
110110
```
111111

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

118-
```console
119-
$ gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
118+
```bash
119+
gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C
120120
```
121121

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

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

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

130130
Then use `gpg --verify SHASUMS256.txt.sig SHASUMS256.txt` to verify

doc/api/addons.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ filename to the `sources` array:
532532
Once the `binding.gyp` file is ready, the example addons can be configured and
533533
built using `node-gyp`:
534534

535-
```console
536-
$ node-gyp configure build
535+
```bash
536+
node-gyp configure build
537537
```
538538

539539
### Function arguments

doc/api/cli.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ Error: Access to this API has been restricted
184184

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

187-
```console
188-
$ node --experimental-permission --allow-fs-read=/path/to/index.js index.js
187+
```bash
188+
node --experimental-permission --allow-fs-read=/path/to/index.js index.js
189189
```
190190

191191
### `--allow-fs-write`
@@ -314,9 +314,9 @@ added: v10.12.0
314314

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

317-
```console
318-
$ node --completion-bash > node_bash_completion
319-
$ source node_bash_completion
317+
```bash
318+
node --completion-bash > node_bash_completion
319+
source node_bash_completion
320320
```
321321

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

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

342-
```console
343-
$ node -C development app.js
342+
```bash
343+
node -C development app.js
344344
```
345345

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

1857-
```console
1858-
$ node --watch index.js
1857+
```bash
1858+
node --watch index.js
18591859
```
18601860

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

1880-
```console
1881-
$ node --watch-path=./src --watch-path=./tests index.js
1880+
```bash
1881+
node --watch-path=./src --watch-path=./tests index.js
18821882
```
18831883

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

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

1892-
```console
1893-
$ node --watch --watch-preserve-output test.js
1892+
```bash
1893+
node --watch --watch-preserve-output test.js
18941894
```
18951895

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

2528-
```console
2529-
$ node --max-old-space-size=1536 index.js
2528+
```bash
2529+
node --max-old-space-size=1536 index.js
25302530
```
25312531

25322532
### `--max-semi-space-size=SIZE` (in megabytes)

doc/api/esm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ all `import` calls. They won't apply to `require` calls; those still follow
711711
712712
Loaders follow the pattern of `--require`:
713713
714-
```console
714+
```bash
715715
node \
716716
--experimental-loader unpkg \
717717
--experimental-loader http-to-https \

doc/api/net.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,8 +1616,8 @@ server.listen(8124, () => {
16161616

16171617
Test this by using `telnet`:
16181618

1619-
```console
1620-
$ telnet localhost 8124
1619+
```bash
1620+
telnet localhost 8124
16211621
```
16221622

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

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

1633-
```console
1634-
$ nc -U /tmp/echo.sock
1633+
```bash
1634+
nc -U /tmp/echo.sock
16351635
```
16361636

16371637
## `net.getDefaultAutoSelectFamily()`

doc/api/process.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,8 @@ argv.forEach((val, index) => {
922922

923923
Launching the Node.js process as:
924924

925-
```console
926-
$ node process-args.js one two=three four
925+
```bash
926+
node process-args.js one two=three four
927927
```
928928

929929
Would generate the output:
@@ -1577,8 +1577,8 @@ reflected outside the Node.js process, or (unless explicitly requested)
15771577
to other [`Worker`][] threads.
15781578
In other words, the following example would not work:
15791579
1580-
```console
1581-
$ node -e 'process.env.foo = "bar"' && echo $foo
1580+
```bash
1581+
node -e 'process.env.foo = "bar"' && echo $foo
15821582
```
15831583
15841584
While the following will:
@@ -1683,8 +1683,8 @@ include the Node.js executable, the name of the script, or any options following
16831683
the script name. These options are useful in order to spawn child processes with
16841684
the same execution environment as the parent.
16851685
1686-
```console
1687-
$ node --harmony script.js --version
1686+
```bash
1687+
node --harmony script.js --version
16881688
```
16891689
16901690
Results in `process.execArgv`:

doc/api/repl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ terminal settings, which will allow use with `rlwrap`.
712712

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

715-
```text
715+
```bash
716716
alias node="env NODE_NO_READLINE=1 rlwrap node"
717717
```
718718

doc/api/single-executable-applications.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,42 @@ Here are the steps for creating a single executable application using one such
2626
tool, [postject][]:
2727

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

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

4040
3. Generate the blob to be injected:
41-
```console
42-
$ node --experimental-sea-config sea-config.json
41+
```bash
42+
node --experimental-sea-config sea-config.json
4343
```
4444

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

4747
* On systems other than Windows:
4848

49-
```console
50-
$ cp $(command -v node) hello
49+
```bash
50+
cp $(command -v node) hello
5151
```
5252

5353
* On Windows:
5454

5555
Using PowerShell:
5656

57-
```console
58-
$ cp (Get-Command node).Source hello.exe
57+
```bash
58+
cp (Get-Command node).Source hello.exe
5959
```
6060

6161
Using Command Prompt:
6262

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

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

7171
* On macOS:
7272

73-
```console
74-
$ codesign --remove-signature hello
73+
```bash
74+
codesign --remove-signature hello
7575
```
7676

7777
* On Windows (optional):
7878

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

82-
```console
83-
$ signtool remove /s hello.exe
82+
```bash
83+
signtool remove /s hello.exe
8484
```
8585

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

102102
* On Linux:
103-
```console
104-
$ npx postject hello NODE_SEA_BLOB sea-prep.blob \
103+
```bash
104+
npx postject hello NODE_SEA_BLOB sea-prep.blob \
105105
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
106106
```
107107

108108
* On Windows:
109-
```console
110-
$ npx postject hello.exe NODE_SEA_BLOB sea-prep.blob \
109+
```bash
110+
npx postject hello.exe NODE_SEA_BLOB sea-prep.blob \
111111
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
112112
```
113113

114114
* On macOS:
115-
```console
116-
$ npx postject hello NODE_SEA_BLOB sea-prep.blob \
115+
```bash
116+
npx postject hello NODE_SEA_BLOB sea-prep.blob \
117117
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
118118
--macho-segment-name NODE_SEA
119119
```
@@ -122,17 +122,17 @@ tool, [postject][]:
122122

123123
* On macOS:
124124

125-
```console
126-
$ codesign --sign - hello
125+
```bash
126+
codesign --sign - hello
127127
```
128128

129129
* On Windows (optional):
130130

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

134-
```console
135-
$ signtool sign /fd SHA256 hello.exe
134+
```bash
135+
signtool sign /fd SHA256 hello.exe
136136
```
137137

138138
8. Run the binary:

doc/api/synopsis.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@ Now, create an empty project folder called `projects`, then navigate into it.
2929

3030
Linux and Mac:
3131

32-
```console
33-
$ mkdir ~/projects
34-
$ cd ~/projects
32+
```bash
33+
mkdir ~/projects
34+
cd ~/projects
3535
```
3636

3737
Windows CMD:
3838

39-
```console
40-
> mkdir %USERPROFILE%\projects
41-
> cd %USERPROFILE%\projects
39+
```powershell
40+
mkdir %USERPROFILE%\projects
41+
cd %USERPROFILE%\projects
4242
```
4343

4444
Windows PowerShell:
4545

46-
```console
47-
> mkdir $env:USERPROFILE\projects
48-
> cd $env:USERPROFILE\projects
46+
```powershell
47+
mkdir $env:USERPROFILE\projects
48+
cd $env:USERPROFILE\projects
4949
```
5050

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

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

76-
```console
77-
$ node hello-world.js
76+
```bash
77+
node hello-world.js
7878
```
7979

8080
Output like this should appear in the terminal:

doc/api/tls.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ failures, it is easy to not notice unnecessarily poor TLS performance. The
285285
OpenSSL CLI can be used to verify that servers are resuming sessions. Use the
286286
`-reconnect` option to `openssl s_client`, for example:
287287

288-
```console
289-
$ openssl s_client -connect localhost:443 -reconnect
288+
```bash
289+
openssl s_client -connect localhost:443 -reconnect
290290
```
291291

292292
Read through the debug output. The first connection should say "New", for

doc/api/wasi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ To run the above example, create a new WebAssembly text format file named
9393

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

96-
```console
97-
$ wat2wasm demo.wat
96+
```bash
97+
wat2wasm demo.wat
9898
```
9999

100100
## Class: `WASI`

0 commit comments

Comments
 (0)