From 3c84556654fb81d73a61b9d19bba3df6aac94e0e Mon Sep 17 00:00:00 2001 From: Maledong Date: Sun, 1 Sep 2019 11:07:24 +0800 Subject: [PATCH] doc: change the 'txt' to 'console' for a command This is the document formation, because `node` is a command to be executed, we should reguard it as a command prompt instead of a command txt type. PR-URL: https://github.com/nodejs/node/pull/29389 Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat --- doc/api/buffer.md | 2 +- doc/api/cluster.md | 2 +- doc/api/debugger.md | 8 ++++---- doc/api/fs.md | 2 +- doc/api/http.md | 4 ++-- doc/api/http2.md | 2 +- doc/api/modules.md | 2 +- doc/api/process.md | 4 ++-- doc/api/repl.md | 2 +- doc/api/stream.md | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index ab7fcac31a7765..46bba08ef15c34 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -133,7 +133,7 @@ performance. Use of the `--zero-fill-buffers` option is recommended only when necessary to enforce that newly allocated `Buffer` instances cannot contain old data that is potentially sensitive. -```txt +```console $ node --zero-fill-buffers > Buffer.allocUnsafe(5); diff --git a/doc/api/cluster.md b/doc/api/cluster.md index fb7328aa4d730b..979ddac5b9223d 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -41,7 +41,7 @@ if (cluster.isMaster) { Running Node.js will now share port 8000 between the workers: -```txt +```console $ node server.js Master 3596 is running Worker 4324 started diff --git a/doc/api/debugger.md b/doc/api/debugger.md index 5a5e1cd7c7acff..318b44de61df79 100644 --- a/doc/api/debugger.md +++ b/doc/api/debugger.md @@ -11,7 +11,7 @@ Node.js includes an out-of-process debugging utility accessible via a with the `inspect` argument followed by the path to the script to debug; a prompt will be displayed indicating successful launch of the debugger: -```txt +```console $ node inspect myscript.js < Debugger listening on ws://127.0.0.1:9229/80e7a814-7cd3-49fb-921a-2e02228cd5ba < For help, see: https://nodejs.org/en/docs/inspector @@ -42,7 +42,7 @@ console.log('hello'); Once the debugger is run, a breakpoint will occur at line 3: -```txt +```console $ node inspect myscript.js < Debugger listening on ws://127.0.0.1:9229/80e7a814-7cd3-49fb-921a-2e02228cd5ba < For help, see: https://nodejs.org/en/docs/inspector @@ -124,7 +124,7 @@ on line 1 It is also possible to set a breakpoint in a file (module) that is not loaded yet: -```txt +```console $ node inspect main.js < Debugger listening on ws://127.0.0.1:9229/4e3db158-9791-4274-8909-914f7facf3bd < For help, see: https://nodejs.org/en/docs/inspector @@ -183,7 +183,7 @@ e.g. `--inspect=9222` will accept DevTools connections on port 9222. To break on the first line of the application code, pass the `--inspect-brk` flag instead of `--inspect`. -```txt +```console $ node --inspect index.js Debugger listening on 127.0.0.1:9229. To start debugging, open the following URL in Chrome: diff --git a/doc/api/fs.md b/doc/api/fs.md index a045f454188701..5341b4bc15ba89 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -85,7 +85,7 @@ variable: Omitting the callback function on asynchronous fs functions is deprecated and may result in an error being thrown in the future. -```txt +```console $ cat script.js function bad() { require('fs').readFile('/'); diff --git a/doc/api/http.md b/doc/api/http.md index 639ac654b71789..ed68a7be0d262f 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1861,7 +1861,7 @@ Then `request.url` will be: To parse the url into its parts `require('url').parse(request.url)` can be used: -```txt +```console $ node > require('url').parse('/status?name=ryan') Url { @@ -1883,7 +1883,7 @@ To extract the parameters from the query string, the `require('querystring').parse` function can be used, or `true` can be passed as the second argument to `require('url').parse`: -```txt +```console $ node > require('url').parse('/status?name=ryan', true) Url { diff --git a/doc/api/http2.md b/doc/api/http2.md index deceafd3ade0cd..2046d903a42320 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2919,7 +2919,7 @@ To extract the parameters from the query string, the `require('querystring').parse` function can be used, or `true` can be passed as the second argument to `require('url').parse`. -```txt +```console $ node > require('url').parse('/status?name=ryan', true) Url { diff --git a/doc/api/modules.md b/doc/api/modules.md index 7197ef6ae2fdaa..b6afe80a0dfeca 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -330,7 +330,7 @@ provided to the `a.js` module. By the time `main.js` has loaded both modules, they're both finished. The output of this program would thus be: -```txt +```console $ node main.js main starting a starting diff --git a/doc/api/process.md b/doc/api/process.md index 7c156e94923308..a36cad64191b70 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -374,7 +374,7 @@ command-line option can be used to suppress the default console output but the The following example illustrates the warning that is printed to `stderr` when too many listeners have been added to an event: -```txt +```console $ node > events.defaultMaxListeners = 1; > process.on('foo', () => {}); @@ -386,7 +386,7 @@ detected. 2 foo listeners added. Use emitter.setMaxListeners() to increase limit In contrast, the following example turns off the default warning output and adds a custom handler to the `'warning'` event: -```txt +```console $ node --no-warnings > const p = process.on('warning', (warning) => console.warn('Do not do that!')); > events.defaultMaxListeners = 1; diff --git a/doc/api/repl.md b/doc/api/repl.md index 1edee77b09b0c3..b53c39dab20399 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -439,7 +439,7 @@ replServer.defineCommand('saybye', function saybye() { The new commands can then be used from within the REPL instance: -```txt +```console > .sayhello Node.js User Hello, Node.js User! > .saybye diff --git a/doc/api/stream.md b/doc/api/stream.md index ccdb7e4180bc32..6510dec5410114 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -900,7 +900,7 @@ rr.on('end', () => { The output of running this script is: -```txt +```console $ node test.js readable: null end