Skip to content

Commit 7bfaf50

Browse files
TrottMylesBorins
authored andcommitted
doc,module: use code markup/markdown in headers
Backport-PR-URL: #31108 PR-URL: #31086 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 30ee4ac commit 7bfaf50

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

doc/api/modules.md

+24-24
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ variable. Since the module lookups using `node_modules` folders are all
132132
relative, and based on the real path of the files making the calls to
133133
`require()`, the packages themselves can be anywhere.
134134

135-
## Addenda: The .mjs extension
135+
## Addenda: The `.mjs` extension
136136

137137
It is not possible to `require()` files that have the `.mjs` extension.
138138
Attempting to do so will throw [an error][]. The `.mjs` extension is
@@ -504,7 +504,7 @@ the module rather than the global object.
504504

505505
## The module scope
506506

507-
### \_\_dirname
507+
### `__dirname`
508508
<!-- YAML
509509
added: v0.1.27
510510
-->
@@ -525,7 +525,7 @@ console.log(path.dirname(__filename));
525525
// Prints: /Users/mjr
526526
```
527527

528-
### \_\_filename
528+
### `__filename`
529529
<!-- YAML
530530
added: v0.0.1
531531
-->
@@ -563,7 +563,7 @@ References to `__filename` within `b.js` will return
563563
`/Users/mjr/app/node_modules/b/b.js` while references to `__filename` within
564564
`a.js` will return `/Users/mjr/app/a.js`.
565565

566-
### exports
566+
### `exports`
567567
<!-- YAML
568568
added: v0.1.12
569569
-->
@@ -576,7 +576,7 @@ A reference to the `module.exports` that is shorter to type.
576576
See the section about the [exports shortcut][] for details on when to use
577577
`exports` and when to use `module.exports`.
578578

579-
### module
579+
### `module`
580580
<!-- YAML
581581
added: v0.1.16
582582
-->
@@ -589,7 +589,7 @@ A reference to the current module, see the section about the
589589
[`module` object][]. In particular, `module.exports` is used for defining what
590590
a module exports and makes available through `require()`.
591591

592-
### require(id)
592+
### `require(id)`
593593
<!-- YAML
594594
added: v0.1.13
595595
-->
@@ -616,7 +616,7 @@ const jsonData = require('./path/filename.json');
616616
const crypto = require('crypto');
617617
```
618618

619-
#### require.cache
619+
#### `require.cache`
620620
<!-- YAML
621621
added: v0.3.0
622622
-->
@@ -633,7 +633,7 @@ native modules and if a name matching a native module is added to the cache,
633633
no require call is
634634
going to receive the native module anymore. Use with care!
635635

636-
#### require.extensions
636+
#### `require.extensions`
637637
<!-- YAML
638638
added: v0.3.0
639639
deprecated: v0.10.6
@@ -659,7 +659,7 @@ program, or compiling them to JavaScript ahead of time.
659659
Avoid using `require.extensions`. Use could cause subtle bugs and resolving the
660660
extensions gets slower with each registered extension.
661661

662-
#### require.main
662+
#### `require.main`
663663
<!-- YAML
664664
added: v0.1.17
665665
-->
@@ -696,7 +696,7 @@ Module {
696696
'/node_modules' ] }
697697
```
698698

699-
#### require.resolve(request\[, options\])
699+
#### `require.resolve(request[, options])`
700700
<!-- YAML
701701
added: v0.3.0
702702
changes:
@@ -718,7 +718,7 @@ changes:
718718
Use the internal `require()` machinery to look up the location of a module,
719719
but rather than loading the module, just return the resolved filename.
720720

721-
##### require.resolve.paths(request)
721+
##### `require.resolve.paths(request)`
722722
<!-- YAML
723723
added: v8.9.0
724724
-->
@@ -745,7 +745,7 @@ representing the current module. For convenience, `module.exports` is
745745
also accessible via the `exports` module-global. `module` is not actually
746746
a global but rather local to each module.
747747

748-
### module.children
748+
### `module.children`
749749
<!-- YAML
750750
added: v0.1.16
751751
-->
@@ -754,7 +754,7 @@ added: v0.1.16
754754

755755
The module objects required for the first time by this one.
756756

757-
### module.exports
757+
### `module.exports`
758758
<!-- YAML
759759
added: v0.1.16
760760
-->
@@ -808,7 +808,7 @@ const x = require('./x');
808808
console.log(x.a);
809809
```
810810

811-
#### exports shortcut
811+
#### `exports` shortcut
812812
<!-- YAML
813813
added: v0.1.16
814814
-->
@@ -855,7 +855,7 @@ function require(/* ... */) {
855855
}
856856
```
857857

858-
### module.filename
858+
### `module.filename`
859859
<!-- YAML
860860
added: v0.1.16
861861
-->
@@ -864,7 +864,7 @@ added: v0.1.16
864864

865865
The fully resolved filename of the module.
866866

867-
### module.id
867+
### `module.id`
868868
<!-- YAML
869869
added: v0.1.16
870870
-->
@@ -874,7 +874,7 @@ added: v0.1.16
874874
The identifier for the module. Typically this is the fully resolved
875875
filename.
876876

877-
### module.loaded
877+
### `module.loaded`
878878
<!-- YAML
879879
added: v0.1.16
880880
-->
@@ -884,7 +884,7 @@ added: v0.1.16
884884
Whether or not the module is done loading, or is in the process of
885885
loading.
886886

887-
### module.parent
887+
### `module.parent`
888888
<!-- YAML
889889
added: v0.1.16
890890
-->
@@ -893,7 +893,7 @@ added: v0.1.16
893893

894894
The module that first required this one.
895895

896-
### module.paths
896+
### `module.paths`
897897
<!-- YAML
898898
added: v0.4.0
899899
-->
@@ -902,7 +902,7 @@ added: v0.4.0
902902

903903
The search paths for the module.
904904

905-
### module.require(id)
905+
### `module.require(id)`
906906
<!-- YAML
907907
added: v0.5.1
908908
-->
@@ -930,7 +930,7 @@ Provides general utility methods when interacting with instances of
930930
`Module` — the `module` variable often seen in file modules. Accessed
931931
via `require('module')`.
932932

933-
### module.builtinModules
933+
### `module.builtinModules`
934934
<!-- YAML
935935
added:
936936
- v9.3.0
@@ -950,7 +950,7 @@ by the [module wrapper][]. To access it, require the `Module` module:
950950
const builtin = require('module').builtinModules;
951951
```
952952

953-
### module.createRequire(filename)
953+
### `module.createRequire(filename)`
954954
<!-- YAML
955955
added: v12.2.0
956956
-->
@@ -968,7 +968,7 @@ const require = createRequire(import.meta.url);
968968
const siblingModule = require('./sibling-module');
969969
```
970970
971-
### module.createRequireFromPath(filename)
971+
### `module.createRequireFromPath(filename)`
972972
<!-- YAML
973973
added: v10.12.0
974974
deprecated: v12.2.0
@@ -988,7 +988,7 @@ const requireUtil = createRequireFromPath('../src/utils/');
988988
requireUtil('./some-tool');
989989
```
990990
991-
### module.syncBuiltinESMExports()
991+
### `module.syncBuiltinESMExports()`
992992
<!-- YAML
993993
added: v12.12.0
994994
-->

0 commit comments

Comments
 (0)