Custom Plugins
Extend the editor with your own toolbar buttons, keyboard shortcuts, renderers, and parsers. Plugins implement the EditorPlugin interface.
Plugin Structure
A plugin is a plain object implementing the EditorPlugin interface:
my-plugin.ts
Registering a Plugin
Pass your plugin object in the plugins array alongside built-in plugin factories:
editor.ts
Plugin Context
The PluginContext passed to init() and destroy() provides access to the editor and dynamic registration methods:
plugin-context.d.ts
Editor API
Inside toolbar actions and via ctx.editor, you have access to the full editor API:
editor-api.d.ts
Dynamic Registration
Plugins can be registered or removed at runtime via the editor instance:
dynamic.ts
EditorPlugin Reference
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique identifier for the plugin. |
init | (ctx: PluginContext) => void | Promise<void> | No | Called once when the plugin is registered. Receives the PluginContext. |
destroy | (ctx: PluginContext) => void | No | Called when the plugin is removed. Clean up resources here. |
toolbarItems | ToolbarItemConfig[] | No | Toolbar buttons contributed by this plugin. |
shortcuts | ShortcutConfig[] | No | Keyboard shortcuts. Key combos like "ctrl+shift+w". |
renderers | RendererConfig[] | No | Custom markdown-to-HTML renderers for the preview pane. |
parsers | ParserConfig[] | No | Custom block parsers for extended MDX syntax. |
styles | string | No | CSS string injected into the editor. |
dependencies | string[] | No | Names of plugins that must be registered first. |
© 2026 SynclineMDX Editor. All rights reserved.