Writing plugins - Fluxdown
Repair plugins process Markdown AST nodes before conversion to HAST and component rendering. Override a built-in plugin's options or add your own processing.
Custom plugins
This plugin adds a paragraph containing … after the generating final block, and stops adding it when the stream ends.
Built-in repair
This response is being generated.
With a custom repair
This response is being generated.
…
Add StreamingIndicatorRepairPlugin to plugins.repairs; see Pass to a component for each renderer’s integration.
Configuration fields
See Plugin design · Shared options for disabled, priority and their defaults.
Plugin configuration
These fields belong to the class instance's config: RepairPluginSystemConfig. They are not arbitrary built-in plugins' constructor options. Declare them in your own class to choose its traversal behavior.
Switch configuration
When using Core directly, pass the list to repairs and set repair and repairEnding in build. UI components translate streaming into the ending flag. See Core quick start.
Plugin members
See Plugin design · Plugin members for key, static methods, constructor, config and destroy. Apart from runner, the hooks below do nothing in the base class; override only those you need.
prepareThis pass: A · B · CbeforebeforeEachrunnerafterEachafterrunner
Type: RepairPluginRunner | RepairPluginRunner[]
Visit nodes and modify the syntax tree. Each runner gets its own traversal.
Original source is available through the optional node.data.source.
prepare
Type: RepairPluginPrepare
Prepare shared information for the pass. Return an optional cleanup function, called in reverse order after all plugins finish.
before / after
Type: RepairPluginHookType
Called once before and after all runners of this plugin, receiving the pass root.
beforeEach / afterEach
Type: RepairPluginHookType
Called before and after each runner’s traversal, receiving the pass root.
Built-in plugin configuration
Other built-in repairs have no additional constructor options. See the Core plugin catalog for full import paths.
Pass to a component
Use plugins.repairs to configure built-in plugins or add the custom plugin above. See Plugin design · Declarations and configuration for declaration rules, overrides and complete examples for each renderer.
Set streaming to match the receiving state; see Syntax repair · Start, pause and finish.
Continue to the built-in catalog, or compare repair strategies in the Benchmark.