Plugin

Plugin<PluginParameters, Input, Output> = (this, …parameters) => Input extends string ? Output extends Node | undefined ? undefined | void : never : Output extends CompileResults ? Input extends Node | undefined ? undefined | void : never : Transformer<Input extends Node ? Input : Node, Output extends Node ? Output : Node> | undefined | void

Defined in: node_modules/unified/lib/index.d.ts:946

Single plugin.

Plugins configure the processors they are applied on in the following ways:

  • they change the processor, such as the parser, the compiler, or by configuring data
  • they specify how to handle trees and files

In practice, they are functions that can receive options and configure the processor (this).

Note: plugins are called when the processor is frozen, not when they are applied.

Type Parameters

Type ParameterDefault type
PluginParameters extends unknown[][]
Input extends stringNode
OutputInput

Parameters

ParameterType
thisProcessor
parametersPluginParameters

Returns

Input extends string ? Output extends Node | undefined ? undefined | void : never : Output extends CompileResults ? Input extends Node | undefined ? undefined | void : never : Transformer<Input extends Node ? Input : Node, Output extends Node ? Output : Node> | undefined | void