Skip to content

Commit 8fac54a

Browse files
gengjiawenrvagg
authored andcommitted
doc: fix code lang in repl.md
PR-URL: #26075 Reviewed-By: Lance Ball <lball@redhat.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent bf61050 commit 8fac54a

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

doc/api/repl.md

+9-18
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ The following special commands are supported by all REPL instances:
4242
`> .load ./file/to/load.js`
4343
* `.editor` - Enter editor mode (`<ctrl>-D` to finish, `<ctrl>-C` to cancel).
4444

45-
<!-- eslint-skip -->
46-
```js
45+
```console
4746
> .editor
4847
// Entering editor mode (^D to finish, ^C to cancel)
4948
function welcome(name) {
@@ -78,8 +77,7 @@ evaluation function when the [`repl.REPLServer`][] instance is created.
7877

7978
The default evaluator supports direct evaluation of JavaScript expressions:
8079

81-
<!-- eslint-skip -->
82-
```js
80+
```console
8381
> 1 + 1
8482
2
8583
> const m = 2
@@ -107,8 +105,7 @@ repl.start('> ').context.m = msg;
107105

108106
Properties in the `context` object appear as local within the REPL:
109107

110-
<!-- eslint-skip -->
111-
```js
108+
```console
112109
$ node repl_test.js
113110
> m
114111
'message'
@@ -136,8 +133,7 @@ REPL environment when used. For instance, unless otherwise declared as a
136133
global or scoped variable, the input `fs` will be evaluated on-demand as
137134
`global.fs = require('fs')`.
138135

139-
<!-- eslint-skip -->
140-
```js
136+
```console
141137
> fs.createReadStream('./some/file');
142138
```
143139

@@ -164,8 +160,7 @@ The default evaluator will, by default, assign the result of the most recently
164160
evaluated expression to the special variable `_` (underscore).
165161
Explicitly setting `_` to a value will disable this behavior.
166162

167-
<!-- eslint-skip -->
168-
```js
163+
```console
169164
> [ 'a', 'b', 'c' ]
170165
[ 'a', 'b', 'c' ]
171166
> _.length
@@ -182,8 +177,7 @@ Expression assignment to _ now disabled.
182177
Similarly, `_error` will refer to the last seen error, if there was any.
183178
Explicitly setting `_error` to a value will disable this behavior.
184179

185-
<!-- eslint-skip -->
186-
```js
180+
```console
187181
> throw new Error('foo');
188182
Error: foo
189183
> _error.message
@@ -195,8 +189,7 @@ Error: foo
195189
With the [`--experimental-repl-await`][] command line option specified,
196190
experimental support for the `await` keyword is enabled.
197191

198-
<!-- eslint-skip -->
199-
```js
192+
```console
200193
> await Promise.resolve(123)
201194
123
202195
> await Promise.reject(new Error('REPL await'))
@@ -341,8 +334,7 @@ r.on('reset', initializeContext);
341334
When this code is executed, the global `'m'` variable can be modified but then
342335
reset to its initial value using the `.clear` command:
343336

344-
<!-- eslint-skip -->
345-
```js
337+
```console
346338
$ ./node example.js
347339
> m
348340
'test'
@@ -534,8 +526,7 @@ Node.js itself uses the `repl` module to provide its own interactive interface
534526
for executing JavaScript. This can be used by executing the Node.js binary
535527
without passing any arguments (or by passing the `-i` argument):
536528

537-
<!-- eslint-skip -->
538-
```js
529+
```console
539530
$ node
540531
> const a = [1, 2, 3];
541532
undefined

0 commit comments

Comments
 (0)