Skip to content

Commit 7d25e44

Browse files
TrottBridgeAR
authored andcommitted
doc,module: use code markup/markdown in headers
PR-URL: #31086 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 699b31f commit 7d25e44

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
@@ -518,7 +518,7 @@ the module rather than the global object.
518518

519519
## The module scope
520520

521-
### \_\_dirname
521+
### `__dirname`
522522
<!-- YAML
523523
added: v0.1.27
524524
-->
@@ -539,7 +539,7 @@ console.log(path.dirname(__filename));
539539
// Prints: /Users/mjr
540540
```
541541

542-
### \_\_filename
542+
### `__filename`
543543
<!-- YAML
544544
added: v0.0.1
545545
-->
@@ -577,7 +577,7 @@ References to `__filename` within `b.js` will return
577577
`/Users/mjr/app/node_modules/b/b.js` while references to `__filename` within
578578
`a.js` will return `/Users/mjr/app/a.js`.
579579

580-
### exports
580+
### `exports`
581581
<!-- YAML
582582
added: v0.1.12
583583
-->
@@ -590,7 +590,7 @@ A reference to the `module.exports` that is shorter to type.
590590
See the section about the [exports shortcut][] for details on when to use
591591
`exports` and when to use `module.exports`.
592592

593-
### module
593+
### `module`
594594
<!-- YAML
595595
added: v0.1.16
596596
-->
@@ -603,7 +603,7 @@ A reference to the current module, see the section about the
603603
[`module` object][]. In particular, `module.exports` is used for defining what
604604
a module exports and makes available through `require()`.
605605

606-
### require(id)
606+
### `require(id)`
607607
<!-- YAML
608608
added: v0.1.13
609609
-->
@@ -630,7 +630,7 @@ const jsonData = require('./path/filename.json');
630630
const crypto = require('crypto');
631631
```
632632

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

650-
#### require.extensions
650+
#### `require.extensions`
651651
<!-- YAML
652652
added: v0.3.0
653653
deprecated: v0.10.6
@@ -673,7 +673,7 @@ program, or compiling them to JavaScript ahead of time.
673673
Avoid using `require.extensions`. Use could cause subtle bugs and resolving the
674674
extensions gets slower with each registered extension.
675675

676-
#### require.main
676+
#### `require.main`
677677
<!-- YAML
678678
added: v0.1.17
679679
-->
@@ -710,7 +710,7 @@ Module {
710710
'/node_modules' ] }
711711
```
712712

713-
#### require.resolve(request\[, options\])
713+
#### `require.resolve(request[, options])`
714714
<!-- YAML
715715
added: v0.3.0
716716
changes:
@@ -732,7 +732,7 @@ changes:
732732
Use the internal `require()` machinery to look up the location of a module,
733733
but rather than loading the module, just return the resolved filename.
734734

735-
##### require.resolve.paths(request)
735+
##### `require.resolve.paths(request)`
736736
<!-- YAML
737737
added: v8.9.0
738738
-->
@@ -759,7 +759,7 @@ representing the current module. For convenience, `module.exports` is
759759
also accessible via the `exports` module-global. `module` is not actually
760760
a global but rather local to each module.
761761

762-
### module.children
762+
### `module.children`
763763
<!-- YAML
764764
added: v0.1.16
765765
-->
@@ -768,7 +768,7 @@ added: v0.1.16
768768

769769
The module objects required for the first time by this one.
770770

771-
### module.exports
771+
### `module.exports`
772772
<!-- YAML
773773
added: v0.1.16
774774
-->
@@ -822,7 +822,7 @@ const x = require('./x');
822822
console.log(x.a);
823823
```
824824

825-
#### exports shortcut
825+
#### `exports` shortcut
826826
<!-- YAML
827827
added: v0.1.16
828828
-->
@@ -869,7 +869,7 @@ function require(/* ... */) {
869869
}
870870
```
871871

872-
### module.filename
872+
### `module.filename`
873873
<!-- YAML
874874
added: v0.1.16
875875
-->
@@ -878,7 +878,7 @@ added: v0.1.16
878878

879879
The fully resolved filename of the module.
880880

881-
### module.id
881+
### `module.id`
882882
<!-- YAML
883883
added: v0.1.16
884884
-->
@@ -888,7 +888,7 @@ added: v0.1.16
888888
The identifier for the module. Typically this is the fully resolved
889889
filename.
890890

891-
### module.loaded
891+
### `module.loaded`
892892
<!-- YAML
893893
added: v0.1.16
894894
-->
@@ -898,7 +898,7 @@ added: v0.1.16
898898
Whether or not the module is done loading, or is in the process of
899899
loading.
900900

901-
### module.parent
901+
### `module.parent`
902902
<!-- YAML
903903
added: v0.1.16
904904
-->
@@ -907,7 +907,7 @@ added: v0.1.16
907907

908908
The module that first required this one.
909909

910-
### module.paths
910+
### `module.paths`
911911
<!-- YAML
912912
added: v0.4.0
913913
-->
@@ -916,7 +916,7 @@ added: v0.4.0
916916

917917
The search paths for the module.
918918

919-
### module.require(id)
919+
### `module.require(id)`
920920
<!-- YAML
921921
added: v0.5.1
922922
-->
@@ -944,7 +944,7 @@ Provides general utility methods when interacting with instances of
944944
`Module` — the `module` variable often seen in file modules. Accessed
945945
via `require('module')`.
946946

947-
### module.builtinModules
947+
### `module.builtinModules`
948948
<!-- YAML
949949
added:
950950
- v9.3.0
@@ -964,7 +964,7 @@ by the [module wrapper][]. To access it, require the `Module` module:
964964
const builtin = require('module').builtinModules;
965965
```
966966

967-
### module.createRequire(filename)
967+
### `module.createRequire(filename)`
968968
<!-- YAML
969969
added: v12.2.0
970970
-->
@@ -982,7 +982,7 @@ const require = createRequire(import.meta.url);
982982
const siblingModule = require('./sibling-module');
983983
```
984984
985-
### module.createRequireFromPath(filename)
985+
### `module.createRequireFromPath(filename)`
986986
<!-- YAML
987987
added: v10.12.0
988988
deprecated: v12.2.0
@@ -1002,7 +1002,7 @@ const requireUtil = createRequireFromPath('../src/utils/');
10021002
requireUtil('./some-tool');
10031003
```
10041004
1005-
### module.syncBuiltinESMExports()
1005+
### `module.syncBuiltinESMExports()`
10061006
<!-- YAML
10071007
added: v12.12.0
10081008
-->

0 commit comments

Comments
 (0)