md-editor-v3

imzbfMIT活跃维护

基于 Vue3 的 Markdown 编辑器组件,用 JSX 和 TypeScript 开发,支持暗色主题、Prettier 格式化、文章直接渲染以及粘贴或截图上传图片。

Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...

v7.1.0发布于 2026-09-28 07:03 UTC2,617star225fork同步于 2026-11-07 07:33 UTC

怎么上手

由 README 提炼,执行前请确认
npm i md-editor-v3
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

Vue3 的 Markdown 编辑器组件,内置预览、主题与图片上传,开箱即用

基于 Vue3 的 Markdown 编辑器组件,用 JSX 和 TypeScript 开发,支持暗色主题、Prettier 格式化、文章直接渲染以及粘贴或截图上传图片。

核心能力

  • 用 prettier 美化 Markdown 内容
  • 支持粘贴或截图上传图片
  • 内置默认与暗色主题,可自定义工具栏
  • 提供 MdPreview 纯渲染模式,无编辑器与事件监听
  • 支持 mermaid 图表与 katex 数学公式

容易踩的坑

需额外引入样式文件,如 md-editor-v3/lib/style.css;纯预览模式要引入 md-editor-v3/lib/preview.css;SSR 下必须给组件传固定不变的 id

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v7.1.0
  1. v7.1.0最新正式版2026-09-28 · 2026-09-28 07:03 UTC

    7.1.0 (2026-09-28)

    Fixed Bugs

    • rerender when the HTML sanitizer changes (commit 99840af)

    • preserve inline tokens in checkbox labels (commit a1a9076)

      • Wrap existing inline tokens with structured labels to preserve
      • formatting and HTML escaping.
    • preserve safe defaults in custom configuration (commit dcb2788)

      • Merge custom options over rendering defaults while keeping trust
      • disabled unless explicitly overridden.
    • isolate rendering state and enforce safe defaults (commit 4905824)

      • Keep strict defaults, serialize library initialization and rendering,
      • and cache sanitized SVGs per preview and code block.
      • Reject outdated async results after content or policy changes and
      • rebind interactions when cached SVGs create new DOM.
    • sanitize chart options before rendering (commit 22307aa)

      • Use rich-text tooltips, escape inherited DataView labels and restrict
      • links across base, timeline and media options. Keep parsing and
      • sanitization independently configurable.
      • Restore source text after render failures and recognize closed
      • backtick, tilde and nested fences.

    Others

    • docs(skills): document renderer security configuration (commit 55916b4)
      • Describe independent ECharts parsing and rendering policies, trusted
      • renderer opt-ins and Mermaid cache invalidation.

    Full Changelog: v7.0.0...v7.1.0


  2. v7.0.02026-09-16 · 2026-09-16 09:29 UTC
    查看更新说明

    7.0.0 (2026-09-16)

    Features

    • support code block line highlighting (commit 1bcd84d)

      • Parse fence metadata for line highlighting, support custom highlighters, and cancel stale delayed preview renders.
    • replace .md-editor-dark with .md-editor[data-theme="dark"] for theme toggling (commit 6d408c9)

    Fixed Bugs

    • disable raw HTML parsing in markdown-it (commit 22ba4aa)

    • correct input box width change event casing (commit d7cf506)

      • Rename oninputBoxWidthChange to onInputBoxWidthChange across event declarations, runtime forwarding, JSX usage, and API references.
      • BREAKING CHANGE: replace oninputBoxWidthChange listeners with onInputBoxWidthChange.
    • replace dynamic option evaluation with JSON5 (commit 909d153)

      • Parse ECharts code blocks as data and require a top-level object.
    • keep code line numbers aligned after wrapping (commit 8202ccd)

    Others

    • chore(deps): upgrade @vavt/markdown-theme (commit d556e26)

    • chore(config): update CDN extensions and v7 integration docs (commit fead4ea)

    • ci(publish): merge beta and latest publish into one workflow (commit 0b2a19c)

      • npm trusted publishing allows only one trusted workflow per package, so
      • both release channels now live in publish.yml and pick the npm dist-tag
      • from the trigger ref. NPM_TOKEN is no longer needed.
      • Release note generation and issue notification move to versioned scripts
      • under .github/scripts/, keeping the workflow file declarative.
      • Checkout keeps fetch-depth: 0 because both scripts resolve the previous
      • tag from history, and pushing the CHANGELOG commit fails on a shallow
      • clone. Publish permissions are scoped to the job, and a concurrency group
      • serializes runs that write to npm or the default branch.

    Full Changelog: v6.5.6...v7.0.0


  3. v6.5.62026-08-05 · 2026-08-05 09:31 UTC
    查看更新说明

    6.5.6 (2026-08-05)

    Fixed Bugs

    Others

    Full Changelog: v6.5.5...v6.5.6


  4. v6.5.52026-07-30 · 2026-07-30 03:05 UTC
    查看更新说明

    See full changelog in CHANGELOG.md.

    New Contributors

    Full Changelog: https://github.com/imzbf/md-editor-v3/compare/v6.5.4...v6.5.5

  5. v6.5.42026-07-17 · 2026-07-17 09:51 UTC
    查看更新说明

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    🎄 md-editor-v3

    English | 中文

    Markdown editor for vue3, developed in jsx and typescript.

    • Documentation and example: Go

    • The same series editor for react: md-editor-rt

    ⭐️ Features

    • Toolbar, screenfull or screenfull in web pages and so on.
    • Themes, Built-in default and dark themes.
    • Shortcut key for editor.
    • Beautify your content by prettier(only for markdown content, not the code and other text).
    • Multi-language, build-in Chinese and English(default: Chinese).
    • Upload picture, paste or clip the picture and upload it.
    • Render article directly(no editor, no event listener, only preview of content).
    • Theme of preview, default, vuepress, github, cyanosis, mk-cute, smart-blue styles(not identical). It can be customized also(Refer to example page).
    • mermaid(>=1.8.0), katex mathematical formula(>=1.9.0).
    • Customize the toolbar as you like.
    • On-demand Import(>=4.0.0).

    🗺 Preview

    Default themeDark themePreview only

    Inputing prompt and mark, emoji extensions

    📦 Install

    npm i md-editor-v3
    

    Use existing extension of language and theme, such as Japanese

    npm i @vavt/cm-extension
    

    Use existing components of toolbar, such as exporting content as PDF

    npm i @vavt/v3-extension
    

    For more ways to use or contribute, please refer to: md-editor-extension

    💡 Usage

    When using server-side rendering, make sure to set id to a constant value.

    Starting from 4.0.0, internal components can be imported on-demand.

    ✍🏻 Display Editor

    <template>
      <MdEditor v-model="text" />
    </template>
    
    <script setup>
    import { ref } from 'vue';
    import { MdEditor } from 'md-editor-v3';
    import 'md-editor-v3/lib/style.css';
    
    const text = ref('# Hello Editor');
    </script>
    

    📖 Preview Only

    <template>
      <MdPreview :id="id" :modelValue="text" />
      <MdCatalog :editorId="id" :scrollElement="scrollElement" />
    </template>
    
    <script setup>
    import { ref } from 'vue';
    import { MdPreview, MdCatalog } from 'md-editor-v3';
    import 'md-editor-v3/lib/preview.css';
    
    const id = 'preview-only';
    const text = ref('# Hello Editor');
    const scrollElement = document.documentElement;
    </script>
    

    When using server-side rendering, scrollElement should be of string type, eg: html, body, #id, .class.


    For more usage, please visit the document.

    🏁 Contribute

    🤝 Commit Convention (Release Aligned)

    The release workflow in .github/workflows/latest.yml reads commit messages to build CHANGELOG.md.

    • Format: <type>(<scope>)!: <summary>
    • Recommended types:
      • feat: goes to Features
      • refactor: goes to Refactors
      • fix: goes to Fixed Bugs
      • other types: goes to Others
    • Subject should describe the user-visible change/problem being solved, not only the mechanical action (e.g. avoid only writing bump xxx).
    • Prefer adding commit body (git cz long description) to explain motivation and impact, especially for dependency upgrades.
    • Do not use pure version subjects like 6.3.2 or v6.3.2-beta.1 (ignored by release parser).
    • docs(changelog): ... is reserved for the bot-generated changelog commit.
    • If you add #123 in subject/body, release automation will notify and close that issue after publishing. Only reference issue numbers that are truly resolved.

    Examples:

    git commit -m "feat(editor): support drag-sort toolbar items"
    git commit -m "fix(preview): sync anchor when heading id contains emoji #1234"
    git commit -m "fix(deps): bump @vavt/markdown-theme to fix mermaid overflow"
    git commit -m "refactor(build): simplify dts rollup pipeline"