doc: refactor manpage to use mdoc(7) macros

Like man(7), mdoc(7) is a macro package for marking up computer manuals.
The main difference is that mdoc is semantic rather than presentational,
providing authors with a full DSL to abstract page markup from low-level
Roff commands. By contrast, `man` is minimalist and leaves formatting to
the author, who is expected to have a working amount of Roff knowledge.

Therefore the use of `mdoc` for marking up Node's manpage is a decidedly
better choice than bare `man`. Less room is left for error and mandoc(1)
offers very robust error-checking and linting.

PR-URL: https://github.com/nodejs/node/pull/18559
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This commit is contained in:
Alhadis 2018-02-04 00:16:50 +11:00 committed by Ruben Bridgewater
parent ea1a07656e
commit ef7f5a11e8
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -1,368 +1,380 @@
.TH NODE 1 2016 Node.js Node.js .\"
.\" This manpage is written in mdoc(7).
.\" This is a man page comment. .\"
.\" * Language reference:
.\" Man page syntax (actually roff syntax) is somewhat obscure, but the .\" https://man.openbsd.org/mdoc.7
.\" important part is is that .<letter> specifies <letter>'s syntax for that .\"
.\" line, and \f<letter> specifies it for the characters that follow. .\" * Atom editor support:
.\" https://atom.io/packages/language-roff
.\" .B Bold line .\"
.\" .I Italic line (Rendered as underlined text in terminals) .\" * Linting changes:
.\" .BI Alternating bold/italics without spaces between arguments. .\" mandoc -Wall -Tlint /path/to/this.file # BSD
.\" Use `\ ` to include an "unpaddable" (literal) space in the output. .\" groff -w all -z /path/to/this.file # GNU/Linux, macOS
.\" .RI Alternating roman/italic .\"
.\"
.\" See http://liw.fi/manpages/ for an overview, or http://www.troff.org/54.pdf .\" Before making changes, please note the following:
.\" for detailed language reference. .\"
.\" * In Roff, each new sentence should begin on a new line. This gives
.\" Macro to display an underlined URL in bold .\" the Roff formatter better control over text-spacing, line-wrapping,
.de ur .\" and paragraph justification.
.nr CF \\n(.f .\"
.ft 4 .\" * Do not leave blank lines in the markup. If whitespace is desired
\\$1 .\" for readability, put a dot in the first column to indicate a null/empty
.ft \\n(CF .\" command. Comments and horizontal whitespace may optionally follow: each
.. .\" of these lines are an example of a null command immediately followed by
.\" a comment.
.\"
.SH NAME .\"======================================================================
.
node \- Server-side JavaScript runtime .Dd 2018
.Dt NODE 1
.
.SH SYNOPSIS .Sh NAME
.Nm node
.B node .Nd server-side JavaScript runtime
.RI [ options ] .
.RI [ v8\ options ] .\"======================================================================
.RI [ script.js \ | .Sh SYNOPSIS
.B -e .Nm node
.RI \&" script \&" .Op Ar options
.RI | .Op Ar v8-options
.B - .Op Fl e Ar string | Ar script.js | Fl
.RI ] .Op Fl \-
.B [--] .Op Ar arguments ...
.RI [ arguments ] .
.br .Nm node
.B node debug .Cm debug
.RI [ script.js " | " .Op Fl e Ar string | Ar script.js | Fl | Ar <host>:<port>
.B \-e .Ar ...
.RI \&" script \&"\ | .
.IR <host>:<port> ] .Nm node
.I ... .Op Fl -v8-options
.br .
.B node .\"======================================================================
.RB [ \-\-v8-options ] .Sh DESCRIPTION
Node.js is a set of libraries for JavaScript which allows it to be used outside of the browser.
Execute without arguments to start the REPL. It is primarily focused on creating simple, easy-to-build network clients and servers.
.Pp
Execute
.SH DESCRIPTION .Nm
without arguments to start a REPL.
Node.js is a set of libraries for JavaScript which allows it to be used outside .
of the browser. It is primarily focused on creating simple, easy to build .Sh OPTIONS
network clients and servers. .Bl -tag -width 6n
.It Fl v , Fl -version
.SH OPTIONS
.TP
.BR \-v ", " \-\-version
Print node's version. Print node's version.
.
.TP .It Fl h , Fl -help
.BR \-h ", " \-\-help
Print node command line options. Print node command line options.
The output of this option is less detailed than this document. The output of this option is less detailed than this document.
.
.TP .It Fl e , Fl -eval Ar string
.BR \-e ", " \-\-eval " " \fR"\fIscript\fR" Evaluate
Evaluate the following argument as JavaScript. .Ar string
as JavaScript.
.TP .
.BR \-p ", " \-\-print " " \fR"\fIscript\fR" .It Fl p , Fl -print Ar string
Identical to \fB-e\fR but prints the result. Identical to
.Fl e ,
.TP but prints the result.
.BR \-c ", " \-\-check .
Syntax check the script without executing. .It Fl c , Fl -check
Check the script's syntax without executing it.
.TP Exits with an error code if script is invalid.
.BR \-i ", " \-\-interactive .
.It Fl i , Fl -interactive
Open the REPL even if stdin does not appear to be a terminal. Open the REPL even if stdin does not appear to be a terminal.
.
.TP .It Fl r , Fl -require Ar module
.BR \-r ", " \-\-require " " \fImodule\fR Preload the specified
Preload the specified module at startup. Follows `require()`'s module resolution .Ar module
rules. \fImodule\fR may be either a path to a file, or a node module name. at startup.
Follows `require()`'s module resolution rules.
.TP .Ar module
.BR \-\-inspect \fI[=[host:]port]\fR may be either a path to a file, or a node module name.
Activate inspector on host:port. Default is 127.0.0.1:9229. .
.It Fl -inspect Ns = Ns Ar [host:]port
V8 Inspector integration allows attaching Chrome DevTools and IDEs to Node.js Activate inspector on
instances for debugging and profiling. It uses the Chrome Debugging Protocol. .Ar host:port .
Default is
.TP .Sy 127.0.0.1:9229 .
.BR \-\-inspect-brk \fI[=[host:]port]\fR .Pp
Activate inspector on host:port and break at start of user script. V8 Inspector integration allows attaching Chrome DevTools and IDEs to Node.js instances for debugging and profiling.
It uses the Chrome Debugging Protocol.
.TP .
.BR \-\-inspect-port \fI=[host:]port\fR .It Fl -inspect-brk Ns = Ns Ar [host:]port
Set the host:port to be used when the inspector is activated. Activate inspector on
.Ar host:port
.TP and break at start of user script.
.BR \-\-no\-deprecation .
.It Fl -inspect-port Ns = Ns Ar [host:]port
Set the
.Ar host:port
to be used when the inspector is activated.
.
.It Fl -no-deprecation
Silence deprecation warnings. Silence deprecation warnings.
.
.TP .It Fl -trace-deprecation
.BR \-\-trace\-deprecation
Print stack traces for deprecations. Print stack traces for deprecations.
.
.TP .It Fl -throw-deprecation
.BR \-\-throw\-deprecation
Throw errors for deprecations. Throw errors for deprecations.
.
.TP .It Fl -pending-deprecation
.BR \-\-pending\-deprecation
Emit pending deprecation warnings. Emit pending deprecation warnings.
.
.TP .It Fl -no-warnings
.BR \-\-no\-warnings
Silence all process warnings (including deprecations). Silence all process warnings (including deprecations).
.
.TP .It Fl -napi-modules
.BR \-\-napi\-modules
Enable loading native modules compiled with the ABI-stable Node.js API (N-API) Enable loading native modules compiled with the ABI-stable Node.js API (N-API)
(experimental). (experimental).
.
.TP .It Fl -abort-on-uncaught-exception
.BR \-\-abort\-on\-uncaught\-exception
Aborting instead of exiting causes a core file to be generated for analysis. Aborting instead of exiting causes a core file to be generated for analysis.
.
.TP .It Fl -trace-warnings
.BR \-\-trace\-warnings
Print stack traces for process warnings (including deprecations). Print stack traces for process warnings (including deprecations).
.
.TP .It Fl -redirect-warnings Ns = Ns Ar file
.BR \-\-redirect\-warnings=\fIfile\fR Write process warnings to the given
Write process warnings to the given file instead of printing to stderr. .Ar file
instead of printing to stderr.
.TP .
.BR \-\-trace\-sync\-io .It Fl -trace-sync-io
Print a stack trace whenever synchronous I/O is detected after the first turn Print a stack trace whenever synchronous I/O is detected after the first turn of the event loop.
of the event loop. .
.It Fl -no-force-async-hooks-checks
.TP Disable runtime checks for `async_hooks`.
.BR \-\-no\-force\-async\-hooks\-checks These will still be enabled dynamically when `async_hooks` is enabled.
Disables runtime checks for `async_hooks`. These will still be enabled .
dynamically when `async_hooks` is enabled. .It Fl -trace-events-enabled
Enable the collection of trace event tracing information.
.TP .
.BR \-\-trace\-events\-enabled .It Fl -trace-event-categories Ar categories
Enables the collection of trace event tracing information. A comma-separated list of categories that should be traced when trace event tracing is enabled using
.Fl -trace-events-enabled .
.TP .
.BR \-\-trace\-event\-categories " " \fIcategories\fR .It Fl -zero-fill-buffers
A comma separated list of categories that should be traced when trace event
tracing is enabled using \fB--trace-events-enabled\fR.
.TP
.BR \-\-zero\-fill\-buffers
Automatically zero-fills all newly allocated Buffer and SlowBuffer instances. Automatically zero-fills all newly allocated Buffer and SlowBuffer instances.
.
.TP .It Fl -preserve-symlinks
.BR \-\-preserve\-symlinks Instructs the module loader to preserve symbolic links when resolving and caching modules.
Instructs the module loader to preserve symbolic links when resolving and .
caching modules. .It Fl -track-heap-objects
.TP
.BR \-\-track\-heap-objects
Track heap object allocations for heap snapshots. Track heap object allocations for heap snapshots.
.
.TP .It Fl -prof-process
.BR \-\-prof\-process Process V8 profiler output generated using the V8 option
Process V8 profiler output generated using the V8 option \fB\-\-prof\fR .Fl -prof .
.
.TP .It Fl -v8-options
.BR \-\-v8\-options Print V8 command-line options.
Print V8 command line options. .Pp
Note: V8 options allow words to be separated by both dashes (\fB-\fR) or underscores (\fB_\fR).
Note: V8 options allow words to be separated by both dashes (\fB-\fR) or .Pp
underscores (\fB_\fR). For example,
.Fl -stack-trace-limit
For example, \fB\-\-stack\-trace\-limit\fR is equivalent to is equivalent to
\fB\-\-stack\_trace\_limit\fR .Fl -stack_trace_limit .
.
.TP .It Fl -v8-pool-size Ns = Ns Ar num
.BR \-\-v8\-pool\-size =\fInum\fR Set V8's thread pool size which will be used to allocate background jobs.
Set v8's thread pool size which will be used to allocate background jobs. If set to 0 then V8 will choose an appropriate size of the thread pool based on the number of online processors.
If set to 0 then V8 will choose an appropriate size of the thread pool based If the value provided is larger than V8's maximum, then the largest value will be chosen.
on the number of online processors. If the value provided is larger than v8's .
max then the largest value will be chosen. .It Fl -tls-cipher-list Ns = Ns Ar list
Specify an alternative default TLS cipher list.
.TP Requires Node.js to be built with crypto support. (Default)
.BR \-\-tls\-cipher\-list =\fIlist\fR .
Specify an alternative default TLS cipher list. (Requires Node.js to be built .It Fl -enable-fips
with crypto support. (Default)) Enable FIPS-compliant crypto at startup.
Requires Node.js to be built with
.TP .Sy ./configure --openssl-fips .
.BR \-\-enable\-fips .
Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with .It Fl -force-fips
\fB./configure \-\-openssl\-fips\fR) Force FIPS-compliant crypto on startup
(Cannot be disabled from script code).
.TP Same requirements as
.BR \-\-force\-fips .Fl -enable-fips .
Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.) .
(Same requirements as \fB\-\-enable\-fips\fR) .It Fl -openssl-config Ns = Ns Ar file
Load an OpenSSL configuration file on startup.
.TP Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with
.BR \-\-openssl\-config =\fIfile\fR .Sy ./configure --openssl-fips .
Load an OpenSSL configuration file on startup. Among other uses, this can be .
used to enable FIPS-compliant crypto if Node.js is built with .It Fl -use-openssl-ca , Fl -use-bundled\-ca
\fB./configure \-\-openssl\-fips\fR. Use OpenSSL's default CA store or use bundled Mozilla CA store as supplied by current Node.js version.
The default store is selectable at build-time.
.TP .Pp
.BR \-\-use\-openssl\-ca,\-\-use\-bundled\-ca Using OpenSSL store allows for external modifications of the store.
Use OpenSSL's default CA store or use bundled Mozilla CA store as supplied by For most Linux and BSD distributions, this store is maintained by the distribution maintainers and system administrators.
current Node.js version. The default store is selectable at build-time. OpenSSL CA store location is dependent on configuration of the OpenSSL library but this can be altered at runtime using environment variables.
.Pp
Using OpenSSL store allows for external modifications of the store. For most The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store that is fixed at release time.
Linux and BSD distributions, this store is maintained by the distribution It is identical on all supported platforms.
maintainers and system administrators. OpenSSL CA store location is dependent on .Pp
configuration of the OpenSSL library but this can be altered at runtime using See
environment variables. .Ev SSL_CERT_DIR
and
The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store .Ev SSL_CERT_FILE .
that is fixed at release time. It is identical on all supported platforms. .
.It Fl -icu-data-dir Ns = Ns Ar file
See \fBSSL_CERT_DIR\fR and \fBSSL_CERT_FILE\fR. Specify ICU data load path.
Overrides
.TP .Ev NODE_ICU_DATA .
.BR \-\-icu\-data\-dir =\fIfile\fR .
Specify ICU data load path. (overrides \fBNODE_ICU_DATA\fR) .It Fl \-experimental-modules
Enable experimental ES module support and caching modules.
.TP .
.BR \-\fR .It Fl \-experimental-vm-modules
Alias for stdin, analogous to the use of - in other command line utilities, Enable experimental ES module support in VM module.
meaning that the script will be read from stdin, and the rest of the options .
are passed to that script. .It Sy \-
Alias for stdin, analogous to the use of - in other command-line utilities.
.TP The executed script is read from stdin, and remaining arguments are passed to the script.
.BR \-\-\fR .
Indicate the end of node options. Pass the rest of the arguments to the script. .It Fl \-
Indicate the end of node options.
Pass the rest of the arguments to the script.
.Pp
If no script filename or eval/print script is supplied prior to this, then If no script filename or eval/print script is supplied prior to this, then
the next argument will be used as a script filename. the next argument will be used as a script filename.
.El
.SH ENVIRONMENT VARIABLES .
.\" =====================================================================
.TP .Sh ENVIRONMENT
.BR NODE_DEBUG =\fImodule\fR[,\fI...\fR] .Bl -tag -width 6n
\',\'\-separated list of core modules that should print debug information. .It Ev NODE_DEBUG Ar modules...
Comma-separated list of core modules that should print debug information.
.TP .
.BR NODE_DISABLE_COLORS =\fI1\fR .It Ev NODE_DISABLE_COLORS
When set to \fI1\fR, colors will not be used in the REPL. When set to
.Ar 1 ,
.TP colors will not be used in the REPL.
.BR NODE_EXTRA_CA_CERTS =\fIfile\fR .
When set, the well known "root" CAs (like VeriSign) will be extended with the .It Ev NODE_EXTRA_CA_CERTS Ar file
extra certificates in \fIfile\fR. The file should consist of one or more When set, the well-known
trusted certificates in PEM format. A message will be emitted (once) with .Dq root
\fBprocess.emitWarning()\fR if the file is missing or misformatted, but any CAs (like VeriSign) will be extended with the extra certificates in
errors are otherwise ignored. .Ar file .
The file should consist of one or more trusted certificates in PEM format.
.TP .Pp
.BR NODE_ICU_DATA =\fIfile\fR If
Data path for ICU (Intl object) data. Will extend linked-in data when compiled .Ar file
with small\-icu support. is missing or misformatted, a message will be emitted once using
.Sy process.emitWarning() ,
.TP but any errors are otherwise ignored.
.BR NODE_NO_WARNINGS =\fI1\fR .
When set to \fI1\fR, process warnings are silenced. .It Ev NODE_ICU_DATA Ar file
Data path for ICU (Intl object) data.
.TP Will extend linked-in data when compiled with small-icu support.
.BR NODE_OPTIONS =\fIoptions...\fR .
A space-separated list of command line options. \fBoptions...\fR are interpreted .It Ev NODE_NO_WARNINGS
as if they had been specified on the command line before the actual command line When set to
(so they can be overridden). Node will exit with an error if an option that is .Ar 1 ,
not allowed in the environment is used, such as \fB-p\fR or a script file. process warnings are silenced.
.
.TP .It Ev NODE_OPTIONS Ar options...
.BR NODE_PATH =\fIpath\fR[:\fI...\fR] A space-separated list of command-line
\':\'\-separated list of directories prefixed to the module search path. .Ar options ,
which are interpreted as if they had been specified on the command-line before the actual command (so they can be overridden).
.TP Node will exit with an error if an option that is not allowed in the environment is used, such as
.BR NODE_PENDING_DEPRECATION = \fI1\fR .Fl -print
When set to \fI1\fR, emit pending deprecation warnings. or a script file.
.
.TP .It Ev NODE_PATH Ar directories...
.BR NODE_REPL_HISTORY =\fIfile\fR A colon-separated list of
Path to the file used to store the persistent REPL history. The default path .Ar directories
is \fB~/.node_repl_history\fR, which is overridden by this variable. Setting the prefixed to the module search path.
value to an empty string ("" or " ") disables persistent REPL history. .
.It Ev NODE_PENDING_DEPRECATION
.TP When set to
.BR OPENSSL_CONF = \fIfile\fR .Ar 1 ,
Load an OpenSSL configuration file on startup. Among other uses, this can be emit pending deprecation warnings.
used to enable FIPS-compliant crypto if Node.js is built with .
\fB./configure \-\-openssl\-fips\fR. .It Ev NODE_REPL_HISTORY Ar file
Path to the
.Ar file
used to store persistent REPL history.
The default path is
.Sy ~/.node_repl_history ,
which is overridden by this variable.
Setting the value to an empty string ("" or " ") will disable persistent REPL history.
.
.It Ev OPENSSL_CONF Ar file
Load an OpenSSL configuration file on startup.
Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with
.Sy ./configure --openssl-fips .
.Pp
If the If the
\fB\-\-openssl\-config\fR .Fl -openssl-config
command line option is used, the environment variable is ignored. command-line option is used, this environment variable is ignored.
.
.TP .It Ev SSL_CERT_DIR Ar dir
.BR SSL_CERT_DIR = \fIdir\fR If
If \fB\-\-use\-openssl\-ca\fR is enabled, this overrides and sets OpenSSL's directory .Fl -use-openssl-ca
containing trusted certificates. is enabled, this overrides and sets OpenSSL's directory containing trusted certificates.
.
.TP .It Ev SSL_CERT_FILE Ar file
.BR SSL_CERT_FILE = \fIfile\fR If
If \fB\-\-use\-openssl\-ca\fR is enabled, this overrides and sets OpenSSL's .Fl -use-openssl-ca
file containing trusted certificates. is enabled, this overrides and sets OpenSSL's file containing trusted certificates.
.
.TP .It Ev NODE_REDIRECT_WARNINGS Ar file
.BR NODE_REDIRECT_WARNINGS=\fIfile\fR Write process warnings to the given
Write process warnings to the given file instead of printing to stderr. .Ar file
(equivalent to using the \-\-redirect\-warnings=\fIfile\fR command-line instead of printing to stderr.
argument). Equivalent to passing
.Fl -redirect-warnings Ar file
.SH BUGS on command-line.
.El
.
.\"=====================================================================
.Sh BUGS
Bugs are tracked in GitHub Issues: Bugs are tracked in GitHub Issues:
.ur https://github.com/nodejs/node/issues .Sy https://github.com/nodejs/node/issues
.
.\"======================================================================
.SH AUTHORS .Sh COPYRIGHT
Written and maintained by 1000+ contributors: Copyright Node.js contributors.
.ur https://github.com/nodejs/node/blob/master/AUTHORS Node.js is available under the MIT license.
.
.Pp
.SH COPYRIGHT Node.js also includes external libraries that are available under a variety of licenses.
Copyright Node.js contributors. Node.js is available under the MIT license. See
.Sy https://github.com/nodejs/node/blob/master/LICENSE
Node.js also includes external libraries that are available under a variety
of licenses. See
.ur https://github.com/nodejs/node/blob/master/LICENSE
for the full license text. for the full license text.
.
.\"======================================================================
.SH RESOURCES AND DOCUMENTATION .Sh SEE ALSO
Website: Website:
.ur https://nodejs.org/ .Sy https://nodejs.org/
.
.Pp
Documentation: Documentation:
.ur https://nodejs.org/api/ .Sy https://nodejs.org/api/
.
.Pp
GitHub repository & Issue Tracker: GitHub repository & Issue Tracker:
.ur https://github.com/nodejs/node .Sy https://github.com/nodejs/node
.
.Pp
Mailing list: Mailing list:
.ur http://groups.google.com/group/nodejs .Sy http://groups.google.com/group/nodejs
.
.Pp
IRC (general questions): IRC (general questions):
.ur "chat.freenode.net #node.js" .Sy "chat.freenode.net #node.js"
(unofficial) (unofficial)
.
.Pp
IRC (Node.js core development): IRC (Node.js core development):
.ur "chat.freenode.net #node-dev" .Sy "chat.freenode.net #node-dev"
.
.\"======================================================================
.Sh AUTHORS
Written and maintained by 1000+ contributors:
.Sy https://github.com/nodejs/node/blob/master/AUTHORS
.