Compiler<
Tree,Result> = (tree,file) =>Result
Defined in: node_modules/unified/lib/index.d.ts:912
A compiler handles the compiling of a syntax tree to something else (in most cases, text) (TypeScript type).
It is used in the stringify phase and called with a Node
and VFile representation of the document to compile.
It should return the textual representation of the given tree (typically
string).
Note: unified typically compiles by serializing: most compilers return
string(orUint8Array). Some compilers, such as the one configured withrehype-react, return other values (in this case, a React tree). If you’re using a compiler that doesn’t serialize, expect different result values.To register custom results in TypeScript, add them to
CompileResultMap.
| Type Parameter | Default type |
|---|---|
Tree extends Node | Node |
Result extends CompileResults | CompileResults |
| Parameter | Type |
|---|---|
tree | Tree |
file | VFile |
Result