Defined in: node_modules/unified/lib/index.d.ts:15
CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>>| Type Parameter | Default type | Description |
|---|---|---|
ParseTree extends Node | undefined | undefined |
HeadTree extends Node | undefined | undefined |
TailTree extends Node | undefined | undefined |
CompileTree extends Node | undefined | undefined |
CompileResult extends CompileResults | undefined | undefined |
Processor(…
parameters):Processor
Defined in: node_modules/unified/lib/index.d.ts:15
| Parameter | Type |
|---|---|
…parameters | [] |
Processor
new Processor<
ParseTree,HeadTree,TailTree,CompileTree,CompileResult>():Processor<ParseTree,HeadTree,TailTree,CompileTree,CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:19
Create a processor.
Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>>.constructor
attachers: [
Plugin<unknown[],undefined,undefined>,...parameters: unknown[]][]
Defined in: node_modules/unified/lib/index.d.ts:52
Internal list of configured plugins.
This is a private internal property and should not be used.
compiler:
undefined|Compiler<CompileTreeextendsundefined?Node:CompileTree,CompileResultextendsundefined?CompileResults:CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:64
Compiler to use.
Compiler:
undefined|Compiler<CompileTreeextendsundefined?Node:CompileTree,CompileResultextendsundefined?CompileResults:CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:33
Compiler to use (deprecated).
Use compiler instead.
freezeIndex:
number
Defined in: node_modules/unified/lib/index.d.ts:72
Internal state to track where we are while freezing.
This is a private internal property and should not be used.
frozen:
undefined|boolean
Defined in: node_modules/unified/lib/index.d.ts:80
Internal state to track whether we’re frozen.
This is a private internal property and should not be used.
namespace:
Data
Defined in: node_modules/unified/lib/index.d.ts:88
Internal state.
This is a private internal property and should not be used.
parser:
undefined|Parser<ParseTreeextendsundefined?Node:ParseTree>
Defined in: node_modules/unified/lib/index.d.ts:97
Parser to use.
Parser:
undefined|Parser<ParseTreeextendsundefined?Node:ParseTree>
Defined in: node_modules/unified/lib/index.d.ts:44
Parser to use (deprecated).
Use parser instead.
transformers:
Pipeline
Defined in: node_modules/unified/lib/index.d.ts:105
Internal list of configured transformers.
This is a private internal property and should not be used.
copy():
Processor<ParseTree,HeadTree,TailTree,CompileTree,CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:117
Copy a processor.
Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
New unfrozen processor (Processor) that is
configured to work the same as its ancestor.
When the descendant processor is configured in the future it does not
affect the ancestral processor.
This is a private internal method and should not be used.
data<
Key>():Data
Defined in: node_modules/unified/lib/index.d.ts:177
Configure the processor with info available to all plugins. Information is stored in an object.
Typically, options can be given to a specific plugin, but sometimes it makes sense to have information shared with several plugins. For example, a list of HTML elements that are self-closing, which is needed during all phases.
Note: setting information cannot occur on frozen processors. Call the processor first to create a new unfrozen processor.
Note: to register custom data in TypeScript, augment the
Datainterface.
| Type Parameter | Description |
|---|---|
Key extends "settings" |
This example show how to get and set info:
data<
Key>(dataset):Processor<ParseTree,HeadTree,TailTree,CompileTree,CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:237
Configure the processor with info available to all plugins. Information is stored in an object.
Typically, options can be given to a specific plugin, but sometimes it makes sense to have information shared with several plugins. For example, a list of HTML elements that are self-closing, which is needed during all phases.
Note: setting information cannot occur on frozen processors. Call the processor first to create a new unfrozen processor.
Note: to register custom data in TypeScript, augment the
Datainterface.
| Type Parameter | Description |
|---|---|
Key extends "settings" |
| Parameter | Type | Description |
|---|---|---|
dataset | Data |
Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
This example show how to get and set info:
data<
Key>(key?):Data[Key]
Defined in: node_modules/unified/lib/index.d.ts:297
Configure the processor with info available to all plugins. Information is stored in an object.
Typically, options can be given to a specific plugin, but sometimes it makes sense to have information shared with several plugins. For example, a list of HTML elements that are self-closing, which is needed during all phases.
Note: setting information cannot occur on frozen processors. Call the processor first to create a new unfrozen processor.
Note: to register custom data in TypeScript, augment the
Datainterface.
| Type Parameter | Description |
|---|---|
Key extends "settings" |
| Parameter | Type | Description |
|---|---|---|
key? | Key |
Data[Key]
This example show how to get and set info:
data<
Key>(key?,value?):Processor<ParseTree,HeadTree,TailTree,CompileTree,CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:357
Configure the processor with info available to all plugins. Information is stored in an object.
Typically, options can be given to a specific plugin, but sometimes it makes sense to have information shared with several plugins. For example, a list of HTML elements that are self-closing, which is needed during all phases.
Note: setting information cannot occur on frozen processors. Call the processor first to create a new unfrozen processor.
Note: to register custom data in TypeScript, augment the
Datainterface.
| Type Parameter | Description |
|---|---|
Key extends "settings" |
| Parameter | Type | Description |
|---|---|---|
key? | Key | |
value? | Data[Key] |
Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
This example show how to get and set info:
freeze():
Processor<ParseTree,HeadTree,TailTree,CompileTree,CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:375
Freeze a processor.
Frozen processors are meant to be extended and not to be configured directly.
When a processor is frozen it cannot be unfrozen. New processors working the same way can be created by calling the processor.
It’s possible to freeze processors explicitly by calling .freeze().
Processors freeze automatically when .parse(), .run(), .runSync(),
.stringify(), .process(), or .processSync() are called.
Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
The current processor.
parse(
file?):ParseTreeextendsundefined?Node:ParseTree
Defined in: node_modules/unified/lib/index.d.ts:390
Parse text to a syntax tree.
Note:
parsefreezes the processor if not already frozen.
Note:
parseperforms the parse phase, not the run phase or other phases.
| Parameter | Type | Description |
|---|---|---|
file? | Compatible | file to parse (optional); typically string or VFile; any value accepted as x in new VFile(x). |
ParseTree extends undefined ? Node : ParseTree
Syntax tree representing file.
process(
file?,done?):undefined
Defined in: node_modules/unified/lib/index.d.ts:433
Process the given file as configured on the processor.
Note:
processfreezes the processor if not already frozen.
Note:
processperforms the parse, run, and stringify phases.
| Parameter | Type | Description |
|---|---|---|
file? | Compatible | |
done? | ProcessCallback<VFileWithOutput<CompileResult>> |
undefined
process(
file?):Promise<VFileWithOutput<CompileResult>>
Defined in: node_modules/unified/lib/index.d.ts:476
Process the given file as configured on the processor.
Note:
processfreezes the processor if not already frozen.
Note:
processperforms the parse, run, and stringify phases.
| Parameter | Type | Description |
|---|---|---|
file? | Compatible |
Promise<VFileWithOutput<CompileResult>>
processSync(
file?):VFileWithOutput<CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:508
Process the given file as configured on the processor.
An error is thrown if asynchronous transforms are configured.
Note:
processSyncfreezes the processor if not already frozen.
Note:
processSyncperforms the parse, run, and stringify phases.
| Parameter | Type | Description |
|---|---|---|
file? | Compatible | File (optional); typically string or VFile; any value accepted as x in new VFile(x). |
VFileWithOutput<CompileResult>
The processed file.
The parsed, transformed, and compiled value is available at
file.value (see note).
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.
run(
tree,done?):undefined
Defined in: node_modules/unified/lib/index.d.ts:547
Run transformers on a syntax tree.
Note:
runfreezes the processor if not already frozen.
Note:
runperforms the run phase, not other phases.
| Parameter | Type | Description |
|---|---|---|
tree | HeadTree extends undefined ? Node : HeadTree | |
done? | RunCallback<TailTree extends undefined ? Node : TailTree> |
undefined
run(
tree,file?,done?):undefined
Defined in: node_modules/unified/lib/index.d.ts:586
Run transformers on a syntax tree.
Note:
runfreezes the processor if not already frozen.
Note:
runperforms the run phase, not other phases.
| Parameter | Type | Description |
|---|---|---|
tree | HeadTree extends undefined ? Node : HeadTree | |
file? | Compatible | |
done? | RunCallback<TailTree extends undefined ? Node : TailTree> |
undefined
run(
tree,file?):Promise<TailTreeextendsundefined?Node:TailTree>
Defined in: node_modules/unified/lib/index.d.ts:625
Run transformers on a syntax tree.
Note:
runfreezes the processor if not already frozen.
Note:
runperforms the run phase, not other phases.
| Parameter | Type | Description |
|---|---|---|
tree | HeadTree extends undefined ? Node : HeadTree | |
file? | Compatible |
Promise<TailTree extends undefined ? Node : TailTree>
runSync(
tree,file?):TailTreeextendsundefined?Node:TailTree
Defined in: node_modules/unified/lib/index.d.ts:643
Run transformers on a syntax tree.
An error is thrown if asynchronous transforms are configured.
Note:
runSyncfreezes the processor if not already frozen.
Note:
runSyncperforms the run phase, not other phases.
| Parameter | Type | Description |
|---|---|---|
tree | HeadTree extends undefined ? Node : HeadTree | Tree to transform and inspect. |
file? | Compatible | File associated with node (optional); any value accepted as x in new VFile(x). |
TailTree extends undefined ? Node : TailTree
Transformed tree.
stringify(
tree,file?):CompileResultextendsundefined?Value:CompileResult
Defined in: node_modules/unified/lib/index.d.ts:673
Compile a syntax tree.
Note:
stringifyfreezes the processor if not already frozen.
Note:
stringifyperforms the stringify phase, not the run phase or other phases.
| Parameter | Type | Description |
|---|---|---|
tree | CompileTree extends undefined ? Node : CompileTree | Tree to compile. |
file? | Compatible | File associated with node (optional); any value accepted as x in new VFile(x). |
CompileResult extends undefined ? Value : CompileResult
Textual representation of the tree (see note).
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.
use<
Parameters_1,Input,Output>(preset?):Processor<ParseTree,HeadTree,TailTree,CompileTree,CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:731
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note:
usecannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
| Type Parameter | Default type | Description |
|---|---|---|
Parameters_1 extends unknown[] | [] | - |
Input extends undefined | string | Node |
Output | Input |
| Parameter | Type | Description |
|---|---|---|
preset? | null | Preset |
Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
There are many ways to pass plugins to .use().
This example gives an overview:
use<
Parameters_1,Input,Output>(list):Processor<ParseTree,HeadTree,TailTree,CompileTree,CompileResult>
Defined in: node_modules/unified/lib/index.d.ts:789
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note:
usecannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
| Type Parameter | Default type | Description |
|---|---|---|
Parameters_1 extends unknown[] | [] | - |
Input extends undefined | string | Node |
Output | Input |
| Parameter | Type | Description |
|---|---|---|
list | PluggableList |
Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>
There are many ways to pass plugins to .use().
This example gives an overview:
use<
Parameters_1,Input,Output>(plugin, …parameters):UsePlugin<ParseTree,HeadTree,TailTree,CompileTree,CompileResult,Input,Output>
Defined in: node_modules/unified/lib/index.d.ts:847
Configure the processor to use a plugin, a list of usable values, or a preset.
If the processor is already using a plugin, the previous plugin configuration is changed based on the options that are passed in. In other words, the plugin is not added a second time.
Note:
usecannot be called on frozen processors. Call the processor first to create a new unfrozen processor.
| Type Parameter | Default type | Description |
|---|---|---|
Parameters_1 extends unknown[] | [] | - |
Input extends undefined | string | Node |
Output | Input |
| Parameter | Type | Description |
|---|---|---|
plugin | Plugin<Parameters_1, Input, Output> | |
…parameters | Parameters_1 | [boolean] |
UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>
There are many ways to pass plugins to .use().
This example gives an overview: