Skip to content

Commit be5450c

Browse files
TrottMylesBorins
authored andcommitted
doc,async_hooks: 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 4087825 commit be5450c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

doc/api/async_hooks.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function destroy(asyncId) { }
7878
function promiseResolve(asyncId) { }
7979
```
8080

81-
#### async_hooks.createHook(callbacks)
81+
#### `async_hooks.createHook(callbacks)`
8282

8383
<!-- YAML
8484
added: v8.1.0
@@ -171,7 +171,7 @@ provided by AsyncHooks itself. The logging should then be skipped when
171171
it was the logging itself that caused AsyncHooks callback to call. By
172172
doing this the otherwise infinite recursion is broken.
173173

174-
#### asyncHook.enable()
174+
#### `asyncHook.enable()`
175175

176176
* Returns: {AsyncHook} A reference to `asyncHook`.
177177

@@ -187,7 +187,7 @@ const async_hooks = require('async_hooks');
187187
const hook = async_hooks.createHook(callbacks).enable();
188188
```
189189

190-
#### asyncHook.disable()
190+
#### `asyncHook.disable()`
191191

192192
* Returns: {AsyncHook} A reference to `asyncHook`.
193193

@@ -203,7 +203,7 @@ Key events in the lifetime of asynchronous events have been categorized into
203203
four areas: instantiation, before/after the callback is called, and when the
204204
instance is destroyed.
205205

206-
##### init(asyncId, type, triggerAsyncId, resource)
206+
##### `init(asyncId, type, triggerAsyncId, resource)`
207207

208208
* `asyncId` {number} A unique ID for the async resource.
209209
* `type` {string} The type of the async resource.
@@ -390,7 +390,7 @@ API the user's callback is placed in a `process.nextTick()`.
390390
The graph only shows *when* a resource was created, not *why*, so to track
391391
the *why* use `triggerAsyncId`.
392392

393-
##### before(asyncId)
393+
##### `before(asyncId)`
394394

395395
* `asyncId` {number}
396396

@@ -407,7 +407,7 @@ asynchronous resources like a TCP server will typically call the `before`
407407
callback multiple times, while other operations like `fs.open()` will call
408408
it only once.
409409

410-
##### after(asyncId)
410+
##### `after(asyncId)`
411411

412412
* `asyncId` {number}
413413

@@ -417,7 +417,7 @@ If an uncaught exception occurs during execution of the callback, then `after`
417417
will run *after* the `'uncaughtException'` event is emitted or a `domain`'s
418418
handler runs.
419419

420-
##### destroy(asyncId)
420+
##### `destroy(asyncId)`
421421

422422
* `asyncId` {number}
423423

@@ -429,7 +429,7 @@ made to the `resource` object passed to `init` it is possible that `destroy`
429429
will never be called, causing a memory leak in the application. If the resource
430430
does not depend on garbage collection, then this will not be an issue.
431431

432-
##### promiseResolve(asyncId)
432+
##### `promiseResolve(asyncId)`
433433

434434
<!-- YAML
435435
added: v8.6.0
@@ -460,7 +460,7 @@ init for PROMISE with id 6, trigger id: 5 # the Promise returned by then()
460460
after 6
461461
```
462462

463-
#### async_hooks.executionAsyncId()
463+
#### `async_hooks.executionAsyncId()`
464464

465465
<!-- YAML
466466
added: v8.1.0
@@ -501,7 +501,7 @@ const server = net.createServer((conn) => {
501501
Promise contexts may not get precise `executionAsyncIds` by default.
502502
See the section on [promise execution tracking][].
503503

504-
#### async_hooks.triggerAsyncId()
504+
#### `async_hooks.triggerAsyncId()`
505505

506506
* Returns: {number} The ID of the resource responsible for calling the callback
507507
that is currently being executed.
@@ -577,7 +577,7 @@ Library developers that handle their own asynchronous resources performing tasks
577577
like I/O, connection pooling, or managing callback queues may use the
578578
`AsyncWrap` JavaScript API so that all the appropriate callbacks are called.
579579

580-
### Class: AsyncResource
580+
### Class: `AsyncResource`
581581

582582
The class `AsyncResource` is designed to be extended by the embedder's async
583583
resources. Using this, users can easily trigger the lifetime events of their
@@ -615,7 +615,7 @@ asyncResource.asyncId();
615615
asyncResource.triggerAsyncId();
616616
```
617617

618-
#### new AsyncResource(type\[, options\])
618+
#### `new AsyncResource(type[, options])`
619619

620620
* `type` {string} The type of async event.
621621
* `options` {Object}
@@ -649,7 +649,7 @@ class DBQuery extends AsyncResource {
649649
}
650650
```
651651

652-
#### asyncResource.runInAsyncScope(fn\[, thisArg, ...args\])
652+
#### `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`
653653
<!-- YAML
654654
added: v9.6.0
655655
-->
@@ -664,7 +664,7 @@ of the async resource. This will establish the context, trigger the AsyncHooks
664664
before callbacks, call the function, trigger the AsyncHooks after callbacks, and
665665
then restore the original execution context.
666666

667-
#### asyncResource.emitDestroy()
667+
#### `asyncResource.emitDestroy()`
668668

669669
* Returns: {AsyncResource} A reference to `asyncResource`.
670670

@@ -673,11 +673,11 @@ be thrown if it is called more than once. This **must** be manually called. If
673673
the resource is left to be collected by the GC then the `destroy` hooks will
674674
never be called.
675675

676-
#### asyncResource.asyncId()
676+
#### `asyncResource.asyncId()`
677677

678678
* Returns: {number} The unique `asyncId` assigned to the resource.
679679

680-
#### asyncResource.triggerAsyncId()
680+
#### `asyncResource.triggerAsyncId()`
681681

682682
* Returns: {number} The same `triggerAsyncId` that is passed to the
683683
`AsyncResource` constructor.

0 commit comments

Comments
 (0)