Configuration
The MarkdownEditor constructor accepts a single MarkdownEditorOptions object. This page documents every field with its type, default, and behavior, plus the related option types.
MarkdownEditorOptions
interface MarkdownEditorOptions {
value?: string;
mode?: EditorMode;
theme?: EditorTheme;
math?: boolean;
mindmap?: boolean;
codeHighlight?: boolean;
tips?: boolean;
preview?: boolean;
onChange?: (value: string) => void;
toolbar?: ToolbarConfig;
onImageUpload?: (file: File) => Promise<string>;
mention?: MentionOptions;
docLink?: DocLinkOptions;
renderDebounce?: number | false;
autoPreview?: boolean;
}
| Option | Type | Default | Description |
|---|---|---|---|
value | string | '' | Initial Markdown content. |
mode | EditorMode | 'simple' | 'simple' renders a pure edit + preview surface with no toolbar or status bar. 'complex' adds the toolbar and status bar. |
theme | EditorTheme | 'light' | Color theme applied via the data-theme attribute: 'light' or 'dark'. |
math | boolean | true | Enable KaTeX math rendering ($...$ inline, $$...$$ block). |
mindmap | boolean | true | Enable Markmap mindmaps from ```mindmap fenced blocks. |
codeHighlight | boolean | true | Enable highlight.js code blocks with the traffic-light header and copy button. |
tips | boolean | true | Enable admonition/callout blocks (:::notice, :::warning, etc.). |
preview | boolean | true | Show the preview pane. When false, only the editor pane is built. |
onChange | (value: string) => void | — | Called with the full document string on every edit. |
toolbar | ToolbarConfig | all actions | Configure which toolbar actions appear and override their labels/icons. |
onImageUpload | (file: File) => Promise<string> | — | Hook invoked when an image file is pasted, dropped, or selected. Resolve to the image URL, which is inserted as . |
mention | MentionOptions | — | @mention dropdown configuration. When omitted, typing @ does not open a dropdown. |
docLink | DocLinkOptions | — | Document-link inserter configuration. When omitted, typing the trigger character does not open a dropdown. |
renderDebounce | number | false | adaptive | Preview debounce in milliseconds. false renders synchronously on every edit; a number sets a fixed delay; when omitted, adaptiveDebounceMs(value.length) is used (120 ms base, up to 600 ms). |
autoPreview | boolean | true | When true, the preview re-renders after edits (debounced). When false, call renderNow() or use the status-bar refresh button to update. |