Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 86f2f83

Browse filesBrowse files
Trottdanielleadams
authored andcommitted
doc: implement fancier rendering for keys
Minimal CSS and markup changes to implement special rendering for `<kbd>` elements. PR-URL: #35400 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
1 parent d642788 commit 86f2f83
Copy full SHA for 86f2f83

File tree

Expand file treeCollapse file tree

2 files changed

+25
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+25
-11
lines changed
Open diff view settings
Collapse file

‎doc/api/repl.md‎

Copy file name to clipboardExpand all lines: doc/api/repl.md
+17-11Lines changed: 17 additions & 11 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ feature set.
3535
The following special commands are supported by all REPL instances:
3636

3737
* `.break`: When in the process of inputting a multi-line expression, enter
38-
the `.break` command (or press **Ctrl+C**) to abort
38+
the `.break` command (or press <kbd>Ctrl</kbd>+<kbd>C</kbd>) to abort
3939
further input or processing of that expression.
4040
* `.clear`: Resets the REPL `context` to an empty object and clears any
4141
multi-line expression being input.
@@ -45,7 +45,8 @@ The following special commands are supported by all REPL instances:
4545
`> .save ./file/to/save.js`
4646
* `.load`: Load a file into the current REPL session.
4747
`> .load ./file/to/load.js`
48-
* `.editor`: Enter editor mode (**Ctrl+D** to finish, **Ctrl+C** to cancel).
48+
* `.editor`: Enter editor mode (<kbd>Ctrl</kbd>+<kbd>D</kbd> to finish,
49+
<kbd>Ctrl</kbd>+<kbd>C</kbd> to cancel).
4950

5051
```console
5152
> .editor
@@ -63,11 +64,12 @@ welcome('Node.js User');
6364

6465
The following key combinations in the REPL have these special effects:
6566

66-
* **Ctrl+C**: When pressed once, has the same effect as the `.break` command.
67+
* <kbd>Ctrl</kbd>+<kbd>C</kbd>: When pressed once, has the same effect as the
68+
`.break` command.
6769
When pressed twice on a blank line, has the same effect as the `.exit`
6870
command.
69-
* **Ctrl+D**: Has the same effect as the `.exit` command.
70-
* `<tab>`: When pressed on a blank line, displays global and local (scope)
71+
* <kbd>Ctrl</kbd>+<kbd>D</kbd>: Has the same effect as the `.exit` command.
72+
* <kbd>Tab</kbd>: When pressed on a blank line, displays global and local (scope)
7173
variables. When pressed while entering other input, displays relevant
7274
autocompletion options.
7375

@@ -246,14 +248,15 @@ added: v13.6.0
246248
-->
247249

248250
The REPL supports bi-directional reverse-i-search similar to [ZSH][]. It is
249-
triggered with **Ctrl+R** to search backward and **Ctrl+S** to search
251+
triggered with <kbd>Ctrl</kbd>+<kbd>R</kbd> to search backward and
252+
<kbd>Ctrl</kbd>+<kbd>S</kbd> to search
250253
forwards.
251254

252255
Duplicated history entires will be skipped.
253256

254257
Entries are accepted as soon as any button is pressed that doesn't correspond
255-
with the reverse search. Cancelling is possible by pressing **Esc** or
256-
**Ctrl+C**.
258+
with the reverse search. Cancelling is possible by pressing <kbd>Esc</kbd> or
259+
<kbd>Ctrl</kbd>+<kbd>C</kbd>.
257260

258261
Changing the direction immediately searches for the next entry in the expected
259262
direction from the current position on.
@@ -379,8 +382,10 @@ added: v0.7.7
379382
-->
380383

381384
The `'exit'` event is emitted when the REPL is exited either by receiving the
382-
`.exit` command as input, the user pressing **Ctrl+C** twice to signal `SIGINT`,
383-
or by pressing **Ctrl+D** to signal `'end'` on the input stream. The listener
385+
`.exit` command as input, the user pressing <kbd>Ctrl</kbd>+<kbd>C</kbd> twice
386+
to signal `SIGINT`,
387+
or by pressing <kbd>Ctrl</kbd>+<kbd>D</kbd> to signal `'end'` on the input
388+
stream. The listener
384389
callback is invoked without any arguments.
385390

386391
```js
@@ -611,7 +616,8 @@ changes:
611616
* `repl.REPL_MODE_STRICT` to evaluate expressions in strict mode. This is
612617
equivalent to prefacing every repl statement with `'use strict'`.
613618
* `breakEvalOnSigint` {boolean} Stop evaluating the current piece of code when
614-
`SIGINT` is received, such as when `Ctrl+C` is pressed. This cannot be used
619+
`SIGINT` is received, such as when <kbd>Ctrl</kbd>+<kbd>C</kbd> is pressed.
620+
This cannot be used
615621
together with a custom `eval` function. **Default:** `false`.
616622
* `preview` {boolean} Defines if the repl prints autocomplete and output
617623
previews or not. **Default:** `true` with the default eval function and
Collapse file

‎doc/api_assets/style.css‎

Copy file name to clipboardExpand all lines: doc/api_assets/style.css
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,14 @@ td > *:last-child {
572572
margin-bottom: 0;
573573
}
574574

575+
kbd {
576+
font-size: 1.2em;
577+
font-weight: 700;
578+
border-radius: 3px;
579+
padding: 1px 2px 0;
580+
border: 1px solid black;
581+
}
582+
575583
.changelog > summary {
576584
margin: .5rem 0;
577585
padding: .5rem 0;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.