CallableInstance
<[], Processor
<ParseTree
, HeadTree
, TailTree
, CompileTree
, CompileResult
>>Type Parameter | Default type | Description |
---|---|---|
ParseTree extends ../../node_modules/@types/unist | undefined | undefined | Output of parse (optional). |
HeadTree extends ../../node_modules/@types/unist | undefined | undefined | Input for run (optional). |
TailTree extends ../../node_modules/@types/unist | undefined | undefined | Output for run (optional). |
CompileTree extends ../../node_modules/@types/unist | undefined | undefined | Input of stringify (optional). |
CompileResult extends CompileResults | undefined | undefined | Output of stringify (optional). |
Processor(…
parameters
):Processor
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>
Parameter | Type |
---|---|
…parameters | [] |
Processor
<ParseTree
, HeadTree
, TailTree
, CompileTree
, CompileResult
>
node_modules/unified/lib/index.d.ts:15
new Processor<
ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>():Processor
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>
Create a processor.
Processor
<ParseTree
, HeadTree
, TailTree
, CompileTree
, CompileResult
>
CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>>.constructor
node_modules/unified/lib/index.d.ts:19
attachers: [
Plugin
<unknown
[],undefined
,undefined
>,...parameters: unknown[]
][]
Internal list of configured plugins.
This is a private internal property and should not be used.
node_modules/unified/lib/index.d.ts:52
compiler:
undefined
|Compiler
<CompileTree
extendsundefined
?Node
:CompileTree
,CompileResult
extendsundefined
?CompileResults
:CompileResult
>
Compiler to use.
node_modules/unified/lib/index.d.ts:64
Compiler:
undefined
|Compiler
<CompileTree
extendsundefined
?Node
:CompileTree
,CompileResult
extendsundefined
?CompileResults
:CompileResult
>
Compiler to use (deprecated).
Use compiler
instead.
node_modules/unified/lib/index.d.ts:33
freezeIndex:
number
Internal state to track where we are while freezing.
This is a private internal property and should not be used.
node_modules/unified/lib/index.d.ts:72
frozen:
undefined
|boolean
Internal state to track whether we’re frozen.
This is a private internal property and should not be used.
node_modules/unified/lib/index.d.ts:80
namespace:
Data
Internal state.
This is a private internal property and should not be used.
node_modules/unified/lib/index.d.ts:88
parser:
undefined
|Parser
<ParseTree
extendsundefined
?Node
:ParseTree
>
Parser to use.
node_modules/unified/lib/index.d.ts:97
Parser:
undefined
|Parser
<ParseTree
extendsundefined
?Node
:ParseTree
>
Parser to use (deprecated).
Use parser
instead.
node_modules/unified/lib/index.d.ts:44
transformers:
Pipeline
Internal list of configured transformers.
This is a private internal property and should not be used.
node_modules/unified/lib/index.d.ts:105
copy():
Processor
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>
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.
node_modules/unified/lib/index.d.ts:117
data<
Key
>():Data
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
Data
interface.
Type Parameter | Description |
---|---|
Key extends "settings" |
The current processor when setting, the value at key
when getting, or
the entire dataset when getting without key.
This example show how to get and set info:
node_modules/unified/lib/index.d.ts:177
data<
Key
>(dataset
):Processor
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>
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
Data
interface.
Type Parameter | Description |
---|---|
Key extends "settings" |
Parameter | Type | Description |
---|---|---|
dataset | Data |
Processor
<ParseTree
, HeadTree
, TailTree
, CompileTree
, CompileResult
>
The current processor when setting, the value at key
when getting, or
the entire dataset when getting without key.
This example show how to get and set info:
node_modules/unified/lib/index.d.ts:237
data<
Key
>(key
?):Data
[Key
]
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
Data
interface.
Type Parameter | Description |
---|---|
Key extends "settings" |
Parameter | Type | Description |
---|---|---|
key ? | Key |
Data
[Key
]
The current processor when setting, the value at key
when getting, or
the entire dataset when getting without key.
This example show how to get and set info:
node_modules/unified/lib/index.d.ts:297
data<
Key
>(key
?,value
?):Processor
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>
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
Data
interface.
Type Parameter | Description |
---|---|
Key extends "settings" |
Parameter | Type | Description |
---|---|---|
key ? | Key | |
value ? | Data [Key ] |
Processor
<ParseTree
, HeadTree
, TailTree
, CompileTree
, CompileResult
>
The current processor when setting, the value at key
when getting, or
the entire dataset when getting without key.
This example show how to get and set info:
node_modules/unified/lib/index.d.ts:357
freeze():
Processor
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>
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.
node_modules/unified/lib/index.d.ts:375
parse(
file
?):ParseTree
extendsundefined
?Node
:ParseTree
Parse text to a syntax tree.
Note:
parse
freezes the processor if not already frozen.
Note:
parse
performs 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
.
node_modules/unified/lib/index.d.ts:390
process(
file
?,done
?):undefined
Process the given file as configured on the processor.
Note:
process
freezes the processor if not already frozen.
Note:
process
performs the parse, run, and stringify phases.
Parameter | Type | Description |
---|---|---|
file ? | Compatible | |
done ? | ProcessCallback <VFileWithOutput <CompileResult >> |
undefined
Nothing if done
is given.
Otherwise a promise, rejected with a fatal error or resolved with 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
.
node_modules/unified/lib/index.d.ts:433
process(
file
?):Promise
<VFileWithOutput
<CompileResult
>>
Process the given file as configured on the processor.
Note:
process
freezes the processor if not already frozen.
Note:
process
performs the parse, run, and stringify phases.
Parameter | Type | Description |
---|---|---|
file ? | Compatible |
Promise
<VFileWithOutput
<CompileResult
>>
Nothing if done
is given.
Otherwise a promise, rejected with a fatal error or resolved with 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
.
node_modules/unified/lib/index.d.ts:476
processSync(
file
?):VFileWithOutput
<CompileResult
>
Process the given file as configured on the processor.
An error is thrown if asynchronous transforms are configured.
Note:
processSync
freezes the processor if not already frozen.
Note:
processSync
performs 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
.
node_modules/unified/lib/index.d.ts:508
run(
tree
,done
?):undefined
Run transformers on a syntax tree.
Note:
run
freezes the processor if not already frozen.
Note:
run
performs the run phase, not other phases.
Parameter | Type | Description |
---|---|---|
tree | HeadTree extends undefined ? Node : HeadTree | |
done ? | RunCallback <TailTree extends undefined ? Node : TailTree > |
undefined
Nothing if done
is given.
Otherwise, a promise rejected with a fatal error or resolved with the
transformed tree.
node_modules/unified/lib/index.d.ts:547
run(
tree
,file
?,done
?):undefined
Run transformers on a syntax tree.
Note:
run
freezes the processor if not already frozen.
Note:
run
performs 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
Nothing if done
is given.
Otherwise, a promise rejected with a fatal error or resolved with the
transformed tree.
node_modules/unified/lib/index.d.ts:586
run(
tree
,file
?):Promise
<TailTree
extendsundefined
?Node
:TailTree
>
Run transformers on a syntax tree.
Note:
run
freezes the processor if not already frozen.
Note:
run
performs the run phase, not other phases.
Parameter | Type | Description |
---|---|---|
tree | HeadTree extends undefined ? Node : HeadTree | |
file ? | Compatible |
Promise
<TailTree
extends undefined
? Node
: TailTree
>
Nothing if done
is given.
Otherwise, a promise rejected with a fatal error or resolved with the
transformed tree.
node_modules/unified/lib/index.d.ts:625
runSync(
tree
,file
?):TailTree
extendsundefined
?Node
:TailTree
Run transformers on a syntax tree.
An error is thrown if asynchronous transforms are configured.
Note:
runSync
freezes the processor if not already frozen.
Note:
runSync
performs 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.
node_modules/unified/lib/index.d.ts:643
stringify(
tree
,file
?):CompileResult
extendsundefined
?Value
:CompileResult
Compile a syntax tree.
Note:
stringify
freezes the processor if not already frozen.
Note:
stringify
performs 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
.
node_modules/unified/lib/index.d.ts:673
use<
Parameters_1
,Input
,Output
>(preset
?):Processor
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>
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:
use
cannot 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 | undefined | |
Output | Input |
Parameter | Type | Description |
---|---|---|
preset ? | null | Preset |
Processor
<ParseTree
, HeadTree
, TailTree
, CompileTree
, CompileResult
>
Current processor.
There are many ways to pass plugins to .use()
.
This example gives an overview:
node_modules/unified/lib/index.d.ts:731
use<
Parameters_1
,Input
,Output
>(list
):Processor
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
>
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:
use
cannot 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 | undefined | |
Output | Input |
Parameter | Type | Description |
---|---|---|
list | PluggableList |
Processor
<ParseTree
, HeadTree
, TailTree
, CompileTree
, CompileResult
>
Current processor.
There are many ways to pass plugins to .use()
.
This example gives an overview:
node_modules/unified/lib/index.d.ts:789
use<
Parameters_1
,Input
,Output
>(plugin
, …parameters
):UsePlugin
<ParseTree
,HeadTree
,TailTree
,CompileTree
,CompileResult
,Input
,Output
>
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:
use
cannot 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 | undefined | |
Output | Input |
Parameter | Type | Description |
---|---|---|
plugin | Plugin <Parameters_1 , Input , Output > | |
…parameters | Parameters_1 | [boolean ] |
UsePlugin
<ParseTree
, HeadTree
, TailTree
, CompileTree
, CompileResult
, Input
, Output
>
Current processor.
There are many ways to pass plugins to .use()
.
This example gives an overview:
node_modules/unified/lib/index.d.ts:847