Slot plugins
Slot plugins control presentation and interaction. Keep the built-in Markdown parsing and render plugins, then replace the corresponding .uvue component to customize blockquotes, links, or code headers.
Write the component
For example, use the theme's accent color for blockquotes:
Import
useThemefrom@fluxdown/uni-app-plugins/base. It returns a reactive theme reference, which the template unwraps automatically.
Declare the plugin
Extend BaseSlotPlugin and declare the slot name and component:
Import
BaseSlotPluginfrom@fluxdown/uni-app-plugins/baseandIPluginItemfrom@fluxdown/uni-app-plugins/typings.
type identifies a built-in slot. Component receives the render plugin's props, while its default slot carries child content. The Markdown source stays the same.
Use the plugin
The last enabled component for a slot type is used. Include <slot /> in your component to preserve its child content.
Other common slots include Heading, Paragraph, Link, Image, CodeBlock, CodeHeader, CodeHighlighter, Table, and Tex. See the plugin matrix for built-in plugins. To change which nodes use these slots, see Render plugins.
Handle links
Built-in links open relative application routes. The application decides how to handle external URLs. Configure onPress on LinkSlotPlugin to use your own browser page or another action:
Import
LinkSlotPluginfrom@fluxdown/uni-app-plugins/plugins/link./pages/browser/indexis a page implemented and registered by your application. WhenonPressis set, it handles every link click.