Rehype plugins
Rehype plugins post-process HAST, the HTML syntax tree produced from Markdown. Use them to change element properties or normalize HTML before rendering.
Declare a plugin
This plugin uses image descriptions as hover titles:
Add rehypes to the Core inputs from the quick start. The transform runs again when a content block is recompiled.
The default sanitizer still processes the output. Properties and tags added by a plugin must be allowed by its schema.
Allow additional HTML tags
Embedded HTML passes through both syntax filtering and HAST sanitization. Configure both stages to allow an extra tag, such as mark:
toClosure turns each configuration object into a readable Core input. Pass both remarks and rehypes to Core. These options extend the existing tag lists. Use the sanitizer's fallback schema to allow additional attributes.
Pass options with a plugin class
You can express the same configuration as [PluginClass, options]. Core passes the options to the constructor and manages the instance:
Choose keyed options to keep built-in configuration together, or class tuples to register and configure plugins in one place. Pass the class; Core creates the instance.
Supported plugins
Append a subpath from the table to @fluxdown/core-plugins/plugins/rehype/ to import a plugin. For example, sanitizer becomes @fluxdown/core-plugins/plugins/rehype/sanitizer.
A check marks plugins included in PRESET_REHYPE_PLUGINS, exported from @fluxdown/core-plugins/presets/rehype. Core registers these automatically; add plugins without a check explicitly.
RawParserRehypePlugin and SanitizerRehypePlugin work together to handle HTML embedded in Markdown. See Allow additional HTML tags for an example.