Render plugins
Render plugins turn HAST nodes into slots, deciding which component receives each piece of content. Slot plugins provide the styling and interactions.
Declare and use
This example sends paragraphs beginning with “Note:” to the blockquote slot and leaves other paragraphs unchanged:
Import the base class, parameter types and
createTypeOfSlotfrom@fluxdown/lynx-plugins/base. Install@fluxdown/lynx-pluginsfirst.
match selects a node; renderChildren renders its children. current, parents and render retain the context needed by the slot.
Keep the JSX render function outside the class and assign it to readonly render. This prevents the ReactLynx compiler from treating the plugin's render method as a class component.
Matching order
Lower priority values match first. At equal priority, later render plugins match first, so your custom plugins take precedence over the preset. Unmatched nodes continue through the preset.
Use slot plugins for changes to components or interactions. To transform HAST first, use a Rehype plugin.