Skip to content

Commit bb2fea9

Browse files
doc: clarify examples section in REPL doc
The current examples presented at the bottom of the REPL doc have two issues: - they look like they're part of the section above (on how to run multiple REPL instances in the same process) but they are not - the alert informing readers not to use the second example in production environments can be wrongly interpreted as to refer to both examples The changes here address both these issues
1 parent f31c880 commit bb2fea9

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

doc/api/repl.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -909,20 +909,22 @@ to connect to both Unix and TCP sockets.
909909
By starting a REPL from a Unix socket-based server instead of stdin, it is
910910
possible to connect to a long-running Node.js process without restarting it.
911911

912-
For an example of running a "full-featured" (`terminal`) REPL over
913-
a `net.Server` and `net.Socket` instance, see:
912+
### Examples
913+
914+
- running a "full-featured" (`terminal`) REPL over
915+
a `net.Server` and `net.Socket` instance:
914916
<https://gist.github.com/TooTallNate/2209310>.
915917

916-
For an example of running a REPL instance over [`curl(1)`][], see:
918+
- running a REPL instance over [`curl(1)`][]:
917919
<https://gist.github.com/TooTallNate/2053342>.
918920

919-
This example is intended purely for educational purposes to demonstrate how
920-
Node.js REPLs can be started using different I/O streams.
921-
It should **not** be used in production environments or any context where security
922-
is a concern without additional protective measures.
923-
If you need to implement REPLs in a real-world application, consider alternative
924-
approaches that mitigate these risks, such as using secure input mechanisms and
925-
avoiding open network interfaces.
921+
**Note**: This example is intended purely for educational purposes to demonstrate how
922+
Node.js REPLs can be started using different I/O streams.
923+
It should **not** be used in production environments or any context where security
924+
is a concern without additional protective measures.
925+
If you need to implement REPLs in a real-world application, consider alternative
926+
approaches that mitigate these risks, such as using secure input mechanisms and
927+
avoiding open network interfaces.
926928

927929
[TTY keybindings]: readline.md#tty-keybindings
928930
[ZSH]: https://en.wikipedia.org/wiki/Z_shell

0 commit comments

Comments
 (0)