Transformer<
Input
,Output
>: (tree
,file
,next
) =>Promise
<Output
|undefined
|void
> |Promise
<never
> |Output
|Error
|undefined
|void
Transformers handle syntax trees and files.
They are functions that are called each time a syntax tree and file are
passed through the run phase.
When an error occurs in them (either because it’s thrown, returned,
rejected, or passed to next
), the process stops.
The run phase is handled by trough
, see its documentation for
the exact semantics of these functions.
Note: you should likely ignore
next
: don’t accept it. it supports callback-style async work. But promises are likely easier to reason about.
Type Parameter | Default type |
---|---|
Input extends ../../node_modules/@types/unist | ../../node_modules/@types/unist |
Output extends ../../node_modules/@types/unist | Input |
Parameter | Type |
---|---|
tree | Input |
file | VFile |
next | TransformCallback <Output > |
Promise
<Output
| undefined
| void
> | Promise
<never
> | Output
| Error
| undefined
| void
node_modules/unified/lib/index.d.ts:1007