Mavon Editor is a versatile Vue-based Markdown editor component designed for rich text editing with Markdown syntax. It officially supports Vue 2 up to version 2.10.4 and Vue 3 from version 3.0.0 onwards, offering a consistent API across major Vue versions. The project maintains an active release cadence, frequently delivering updates, bug fixes, and security enhancements. Key features include integrated image upload capabilities, full-screen editing mode, theme support, and robust XSS protection (significantly improved in v2.10.x). Its primary differentiators are its comprehensive dual support for both Vue 2 and Vue 3 ecosystems, along with its strong focus on security, making it a reliable plug-and-play component for Markdown editing needs in Vue applications.
npm install mavon-editorVerified import paths — ran on the pinned version, not inferred.
Demonstrates global registration of Mavon Editor as a Vue 3 plugin and its usage within a root component. It showcases two-way data binding with `v-model`, basic configuration props, and event handling for markdown and HTML output, including a placeholder for image upload.
For Vue 2 projects, explicitly install `mavon-editor@2` (e.g., `npm install mavon-editor@2`). For Vue 3 projects, install the latest version, typically `npm install mavon-editor@latest`.
If custom HTML attributes or specific tags are necessary, configure the `xssOptions.whiteList` property in the editor's options to explicitly permit them (e.g., `{ whiteList: { span: ['style'] } }`). For maximum security, consider setting `html: false` if raw HTML embedding is not a core requirement.Always use a default import for the plugin: `import mavonEditor from 'mavon-editor';`.
Ensure that `import 'mavon-editor/dist/css/index.css';` is included in your main application entry file (e.g., `main.js` or `main.ts`) or within the root component where Mavon Editor is used.
Verify that you have correctly imported the `mavonEditor` plugin (default import) and then registered it globally using `app.use(mavonEditor)` (for Vue 3) or `Vue.use(mavonEditor)` (for Vue 2) in your application's entry point.
Ensure you are using a default import for the plugin: `import mavonEditor from 'mavon-editor';`. If using CommonJS, confirm `const mavonEditor = require('mavon-editor');` (or `require('mavon-editor').default` in some interop cases) correctly provides the plugin object.In your editor's configuration options, specify the `xssOptions.whiteList` property to explicitly allow the HTML tags and attributes you need. For example, to allow `style` on `<span>` tags: `{ xssOptions: { whiteList: { span: ['style'] } } }`.