GeezerVison is showing github.com — doc: harmonize fenced code snippet flags · nodejs/node@12fef9b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: BUILDING.md +98-98Lines changed: 98 additions & 98 deletions - Display the source diff
- Display the rich diff
Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: README.md +8-8Lines changed: 8 additions & 8 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -98,15 +98,15 @@ files. | 98 | 98 |
| 99 | 99 | To download `SHASUMS256.txt` using `curl`: | 100 | 100 |
| 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 | 103 | 103 | ``` | 104 | 104 |
| 105 | 105 | To check that a downloaded file matches the checksum, run | 106 | 106 | it through `sha256sum` with a command such as: | 107 | 107 |
| 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 - | 110 | 110 | ``` | 111 | 111 |
| 112 | 112 | 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 | 115 | 115 | [the GPG keys of individuals authorized to create releases](#release-keys). To | 116 | 116 | import the keys: | 117 | 117 |
| 118 | | -```console | 119 | | -$ gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C | | 118 | +```bash | | 119 | +gpg --keyserver hkps://keys.openpgp.org --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C | 120 | 120 | ``` | 121 | 121 |
| 122 | 122 | See [Release keys](#release-keys) for a script to import active release keys. | 123 | 123 |
| 124 | 124 | Next, download the `SHASUMS256.txt.sig` for the release: | 125 | 125 |
| 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 | 128 | 128 | ``` | 129 | 129 |
| 130 | 130 | Then use `gpg --verify SHASUMS256.txt.sig SHASUMS256.txt` to verify | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/addons.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -532,8 +532,8 @@ filename to the `sources` array: | 532 | 532 | Once the `binding.gyp` file is ready, the example addons can be configured and | 533 | 533 | built using `node-gyp`: | 534 | 534 |
| 535 | | -```console | 536 | | -$ node-gyp configure build | | 535 | +```bash | | 536 | +node-gyp configure build | 537 | 537 | ``` | 538 | 538 |
| 539 | 539 | ### Function arguments | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/cli.md +15-15Lines changed: 15 additions & 15 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -184,8 +184,8 @@ Error: Access to this API has been restricted | 184 | 184 |
| 185 | 185 | The process needs to have access to the `index.js` module: | 186 | 186 |
| 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 | 189 | 189 | ``` | 190 | 190 |
| 191 | 191 | ### `--allow-fs-write` | @@ -314,9 +314,9 @@ added: v10.12.0 | 314 | 314 |
| 315 | 315 | Print source-able bash completion script for Node.js. | 316 | 316 |
| 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 | 320 | 320 | ``` | 321 | 321 |
| 322 | 322 | ### `-C condition`, `--conditions=condition` | @@ -339,8 +339,8 @@ The default Node.js conditions of `"node"`, `"default"`, `"import"`, and | 339 | 339 |
| 340 | 340 | For example, to run a module with "development" resolutions: | 341 | 341 |
| 342 | | -```console | 343 | | -$ node -C development app.js | | 342 | +```bash | | 343 | +node -C development app.js | 344 | 344 | ``` | 345 | 345 |
| 346 | 346 | ### `--cpu-prof` | @@ -1854,8 +1854,8 @@ Use `--watch-path` to specify what paths to watch. | 1854 | 1854 | This flag cannot be combined with | 1855 | 1855 | `--check`, `--eval`, `--interactive`, or the REPL. | 1856 | 1856 |
| 1857 | | -```console | 1858 | | -$ node --watch index.js | | 1857 | +```bash | | 1858 | +node --watch index.js | 1859 | 1859 | ``` | 1860 | 1860 |
| 1861 | 1861 | ### `--watch-path` | @@ -1877,8 +1877,8 @@ combination with `--watch`. | 1877 | 1877 | This flag cannot be combined with | 1878 | 1878 | `--check`, `--eval`, `--interactive`, `--test`, or the REPL. | 1879 | 1879 |
| 1880 | | -```console | 1881 | | -$ node --watch-path=./src --watch-path=./tests index.js | | 1880 | +```bash | | 1881 | +node --watch-path=./src --watch-path=./tests index.js | 1882 | 1882 | ``` | 1883 | 1883 |
| 1884 | 1884 | 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. | 1889 | 1889 |
| 1890 | 1890 | Disable the clearing of the console when watch mode restarts the process. | 1891 | 1891 |
| 1892 | | -```console | 1893 | | -$ node --watch --watch-preserve-output test.js | | 1892 | +```bash | | 1893 | +node --watch --watch-preserve-output test.js | 1894 | 1894 | ``` | 1895 | 1895 |
| 1896 | 1896 | ### `--zero-fill-buffers` | @@ -2525,8 +2525,8 @@ garbage collection in an effort to free unused memory. | 2525 | 2525 | On a machine with 2 GiB of memory, consider setting this to | 2526 | 2526 | 1536 (1.5 GiB) to leave some memory for other uses and avoid swapping. | 2527 | 2527 |
| 2528 | | -```console | 2529 | | -$ node --max-old-space-size=1536 index.js | | 2528 | +```bash | | 2529 | +node --max-old-space-size=1536 index.js | 2530 | 2530 | ``` | 2531 | 2531 |
| 2532 | 2532 | ### `--max-semi-space-size=SIZE` (in megabytes) | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/esm.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -711,7 +711,7 @@ all `import` calls. They won't apply to `require` calls; those still follow | 711 | 711 |
| 712 | 712 | Loaders follow the pattern of `--require`: | 713 | 713 |
| 714 | | -```console | | 714 | +```bash | 715 | 715 | node \ | 716 | 716 | --experimental-loader unpkg \ | 717 | 717 | --experimental-loader http-to-https \ | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/net.md +4-4Lines changed: 4 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1616,8 +1616,8 @@ server.listen(8124, () => { | 1616 | 1616 |
| 1617 | 1617 | Test this by using `telnet`: | 1618 | 1618 |
| 1619 | | -```console | 1620 | | -$ telnet localhost 8124 | | 1619 | +```bash | | 1620 | +telnet localhost 8124 | 1621 | 1621 | ``` | 1622 | 1622 |
| 1623 | 1623 | To listen on the socket `/tmp/echo.sock`: | @@ -1630,8 +1630,8 @@ server.listen('/tmp/echo.sock', () => { | 1630 | 1630 |
| 1631 | 1631 | Use `nc` to connect to a Unix domain socket server: | 1632 | 1632 |
| 1633 | | -```console | 1634 | | -$ nc -U /tmp/echo.sock | | 1633 | +```bash | | 1634 | +nc -U /tmp/echo.sock | 1635 | 1635 | ``` | 1636 | 1636 |
| 1637 | 1637 | ## `net.getDefaultAutoSelectFamily()` | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/process.md +6-6Lines changed: 6 additions & 6 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -922,8 +922,8 @@ argv.forEach((val, index) => { | 922 | 922 |
| 923 | 923 | Launching the Node.js process as: | 924 | 924 |
| 925 | | -```console | 926 | | -$ node process-args.js one two=three four | | 925 | +```bash | | 926 | +node process-args.js one two=three four | 927 | 927 | ``` | 928 | 928 |
| 929 | 929 | Would generate the output: | @@ -1577,8 +1577,8 @@ reflected outside the Node.js process, or (unless explicitly requested) | 1577 | 1577 | to other [`Worker`][] threads. | 1578 | 1578 | In other words, the following example would not work: | 1579 | 1579 |
| 1580 | | -```console | 1581 | | -$ node -e 'process.env.foo = "bar"' && echo $foo | | 1580 | +```bash | | 1581 | +node -e 'process.env.foo = "bar"' && echo $foo | 1582 | 1582 | ``` | 1583 | 1583 |
| 1584 | 1584 | While the following will: | @@ -1683,8 +1683,8 @@ include the Node.js executable, the name of the script, or any options following | 1683 | 1683 | the script name. These options are useful in order to spawn child processes with | 1684 | 1684 | the same execution environment as the parent. | 1685 | 1685 |
| 1686 | | -```console | 1687 | | -$ node --harmony script.js --version | | 1686 | +```bash | | 1687 | +node --harmony script.js --version | 1688 | 1688 | ``` | 1689 | 1689 |
| 1690 | 1690 | Results in `process.execArgv`: | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/repl.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -712,7 +712,7 @@ terminal settings, which will allow use with `rlwrap`. | 712 | 712 |
| 713 | 713 | For example, the following can be added to a `.bashrc` file: | 714 | 714 |
| 715 | | -```text | | 715 | +```bash | 716 | 716 | alias node="env NODE_NO_READLINE=1 rlwrap node" | 717 | 717 | ``` | 718 | 718 |
| |
Collapse file Copy file name to clipboardExpand all lines: doc/api/single-executable-applications.md +26-26Lines changed: 26 additions & 26 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -26,42 +26,42 @@ Here are the steps for creating a single executable application using one such | 26 | 26 | tool, [postject][]: | 27 | 27 |
| 28 | 28 | 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 | 31 | 31 | ``` | 32 | 32 |
| 33 | 33 | 2. Create a configuration file building a blob that can be injected into the | 34 | 34 | single executable application (see | 35 | 35 | [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 | 38 | 38 | ``` | 39 | 39 |
| 40 | 40 | 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 | 43 | 43 | ``` | 44 | 44 |
| 45 | 45 | 4. Create a copy of the `node` executable and name it according to your needs: | 46 | 46 |
| 47 | 47 | * On systems other than Windows: | 48 | 48 |
| 49 | | - ```console | 50 | | - $ cp $(command -v node) hello | | 49 | + ```bash | | 50 | + cp $(command -v node) hello | 51 | 51 | ``` | 52 | 52 |
| 53 | 53 | * On Windows: | 54 | 54 |
| 55 | 55 | Using PowerShell: | 56 | 56 |
| 57 | | - ```console | 58 | | - $ cp (Get-Command node).Source hello.exe | | 57 | + ```bash | | 58 | + cp (Get-Command node).Source hello.exe | 59 | 59 | ``` | 60 | 60 |
| 61 | 61 | Using Command Prompt: | 62 | 62 |
| 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) | 65 | 65 | ``` | 66 | 66 |
| 67 | 67 | The `.exe` extension is necessary. | @@ -70,17 +70,17 @@ tool, [postject][]: | 70 | 70 |
| 71 | 71 | * On macOS: | 72 | 72 |
| 73 | | - ```console | 74 | | - $ codesign --remove-signature hello | | 73 | + ```bash | | 74 | + codesign --remove-signature hello | 75 | 75 | ``` | 76 | 76 |
| 77 | 77 | * On Windows (optional): | 78 | 78 |
| 79 | 79 | [signtool][] can be used from the installed [Windows SDK][]. If this step is | 80 | 80 | skipped, ignore any signature-related warning from postject. | 81 | 81 |
| 82 | | - ```console | 83 | | - $ signtool remove /s hello.exe | | 82 | + ```bash | | 83 | + signtool remove /s hello.exe | 84 | 84 | ``` | 85 | 85 |
| 86 | 86 | 6. Inject the blob into the copied binary by running `postject` with | @@ -100,20 +100,20 @@ tool, [postject][]: | 100 | 100 | To summarize, here is the required command for each platform: | 101 | 101 |
| 102 | 102 | * 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 \ | 105 | 105 | --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | 106 | 106 | ``` | 107 | 107 |
| 108 | 108 | * 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 \ | 111 | 111 | --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | 112 | 112 | ``` | 113 | 113 |
| 114 | 114 | * 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 \ | 117 | 117 | --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \ | 118 | 118 | --macho-segment-name NODE_SEA | 119 | 119 | ``` | @@ -122,17 +122,17 @@ tool, [postject][]: | 122 | 122 |
| 123 | 123 | * On macOS: | 124 | 124 |
| 125 | | - ```console | 126 | | - $ codesign --sign - hello | | 125 | + ```bash | | 126 | + codesign --sign - hello | 127 | 127 | ``` | 128 | 128 |
| 129 | 129 | * On Windows (optional): | 130 | 130 |
| 131 | 131 | A certificate needs to be present for this to work. However, the unsigned | 132 | 132 | binary would still be runnable. | 133 | 133 |
| 134 | | - ```console | 135 | | - $ signtool sign /fd SHA256 hello.exe | | 134 | + ```bash | | 135 | + signtool sign /fd SHA256 hello.exe | 136 | 136 | ``` | 137 | 137 |
| 138 | 138 | 8. Run the binary: | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/synopsis.md +11-11Lines changed: 11 additions & 11 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -29,23 +29,23 @@ Now, create an empty project folder called `projects`, then navigate into it. | 29 | 29 |
| 30 | 30 | Linux and Mac: | 31 | 31 |
| 32 | | -```console | 33 | | -$ mkdir ~/projects | 34 | | -$ cd ~/projects | | 32 | +```bash | | 33 | +mkdir ~/projects | | 34 | +cd ~/projects | 35 | 35 | ``` | 36 | 36 |
| 37 | 37 | Windows CMD: | 38 | 38 |
| 39 | | -```console | 40 | | -> mkdir %USERPROFILE%\projects | 41 | | -> cd %USERPROFILE%\projects | | 39 | +```powershell | | 40 | +mkdir %USERPROFILE%\projects | | 41 | +cd %USERPROFILE%\projects | 42 | 42 | ``` | 43 | 43 |
| 44 | 44 | Windows PowerShell: | 45 | 45 |
| 46 | | -```console | 47 | | -> mkdir $env:USERPROFILE\projects | 48 | | -> cd $env:USERPROFILE\projects | | 46 | +```powershell | | 47 | +mkdir $env:USERPROFILE\projects | | 48 | +cd $env:USERPROFILE\projects | 49 | 49 | ``` | 50 | 50 |
| 51 | 51 | Next, create a new source file in the `projects` | @@ -73,8 +73,8 @@ server.listen(port, hostname, () => { | 73 | 73 |
| 74 | 74 | Save the file, go back to the terminal window, and enter the following command: | 75 | 75 |
| 76 | | -```console | 77 | | -$ node hello-world.js | | 76 | +```bash | | 77 | +node hello-world.js | 78 | 78 | ``` | 79 | 79 |
| 80 | 80 | Output like this should appear in the terminal: | |
|