
Easy-to-use Markdown editor, born to adapt to different application scenarios
Vditor is a browser-side Markdown editor, Support WYSIWYG, instant rendering (similar to Typora) and split-screen preview mode. It is implemented using TypeScript and supports native JavaScript and frameworks such as Vue, React, Angular, and Svelte..
Welcome to Vditor Official Site to learn more.
With the popularization of Markdown typesetting methods, more and more applications begin to integrate the Markdown editor. The current status of mainstream integrable Markdown editors is as follows:
These three points correspond to three application scenarios:
Therefore, a Markdown editor that can adapt to application scenarios is essential, it needs to consider:
Vditor has made efforts in these areas, hoping to make some contributions to the modern general Markdown editing field.


WYSIWYG mode is more friendly to users who are not familiar with Markdown, and you can use it seamlessly if you are familiar with Markdown.

Instant Rendering mode should not be unfamiliar to users who are familiar with Typora. In theory, this is the most elegant Markdown editing method.

The traditional Split View mode is suitable for Markdown editing on a large screen.

Most of the above features can be enabled or disabled through the switch configuration, developers can choose to match according to their own application scenarios.
npm install vditor --save
import Vditor from 'vditor'
import "~vditor/src/assets/less/index" // Or use dark
const vditor = new Vditor(id, {options...})
<link rel="stylesheet" href="https://unpkg.com/vditor/dist/index.css" />
<script src="https://unpkg.com/vditor/dist/index.min.js"></script>
class="vditor-reset" (classic theme) or class="vditor-reset vditor-reset--dark" (black theme) attribute on the content display element can display the content more friendlyCan be filled with element id or element itselfHTMLElement
⚠️: When filling in the element's HTMLElement, you need to set options.cache.id or set options.cache.enable to false
| Explanation | Default | |
|---|---|---|
| i18n | I18n, more details see ITips | - |
| undoDelay | Undo interval | - |
| after | Callback method after editor asynchronous rendering is completed | - |
| height | Total editor height | 'auto' |
| minHeight | Editing area minimum height | - |
| width | Total editor width, supports % | 'auto' |
| placeholder | Tips when the input area is empty | '' |
| lang | I18n type: de_DE, en_US, es_ES, fr_FR, ja_JP, ko_KR, pt_BR, ru_RU, sv_SE, vi_VN, zh_CN, zh_TW | 'zh_CN' |
| input(value: string) | Trigger after input | - |
| focus(value: string) | Trigger after focusing | - |
| blur(value: string) | Trigger after out of focus | - |
| keydown(event: KeyboardEvent) | Trigger after keydown | - |
| esc(value: string) | Trigger after pressing | - |
| ctrlEnter(value: string) | Trigger after pressing ⌘/ctrl+enter | - |
| select(value: string) | Triggered after selecting text in the editor | - |
| unSelect() | Triggered after un selecting text in the editor | - |
| tab | tab key operation string, support \ t and any string |
- |
| typewriterMode | Whether to enable typewriter mode | false |
| cdn | Configure self-built CDN address | https://unpkg.com/vditor@${VDITOR_VERSION} |
| mode | Editing mode: sv, ir, wysiwyg | 'ir' |
| debugger | Whether to display the log | false |
| value | Editor initialization value | '' |
| theme | Theme: classic, dark | 'classic' |
| icon | icon theme: ant, material | 'ant' |
| customRenders: {language: string, render: (element: HTMLElement, vditor: IVditor) => void}[] | Custom render | [] |
| customWysiwygToolbar(type: TWYSISYGToolbar, element: HTMLElement): void | Customizing the toolbar in wysiwyg mode | - |
toolbar: ['emoji', 'br', 'bold', '|', 'line']. See default src/ts/util/Options.tsemoji , headings , bold , italic , strike , | , line , quote , list , ordered-list , check ,outdent ,indent , code , inline-code, insert-after, insert-before, code-theme, content-theme, export, undo , redo , upload , link , table , record , edit-mode , both , preview , fullscreen , outline , devtools , info , help , brname is not in the enumeration, you can add a custom button in the following format:```js new Vditor('vditor', { toolbar: [ { hotkey: '⇧⌘S', name: 'sponsor', tipPosition: 's', tip: '成为赞助者', className: 'right', icon: '
$ claude mcp add vditor \
-- python -m otcore.mcp_server <graph>