Skip to content

Common extensions for md-editor-v3 and md-editor-rt.

License

Notifications You must be signed in to change notification settings

mickey58github/md-editor-extension

 
 

Repository files navigation

md-editor-extension

English | 中文

Share your configuration of md-editor-v3 and md-editor-rt. And the extension components of the editor.

Usage

@vavt/cm-extension

This is a public configuration library that includes languages and themes.

yarn add @vavt/cm-extension

Language

name description author
zh-TW Chinese ( Traditional) @imzbf
fr-FR French @tofandel
jp-JP Japanese @xj89959853
id-ID Bahasa Indonesia @vallerydelexy
jv-ID Basa Jawa @vallerydelexy
ru Russian @gorgulenkozxc
pt-BR Brazilian Portuguese @kleberMRocha
de-DE German @JehtJanich
it-IT Italien @JehtJanich

PreviewTheme

name description author
arknights From juejin-markdown-theme-arknights, author: @viewweiwu @imzbf

md-editor-v3

<template>
  <MdEditor language="zh-TW" preview-theme="arknights" />
</template>

<script setup>
import { MdEditor, config } from 'md-editor-v3';
// import theme css
import '@vavt/cm-extension/dist/previewTheme/arknights.css';
// import existing language
import ZH_TW from '@vavt/cm-extension/dist/locale/zh-TW';

config({
  editorConfig: {
    languageUserDefined: {
      'zh-TW': ZH_TW
    }
  }
});
</script>

md-editor-rt

import React from 'react';
import { MdEditor, config } from 'md-editor-rt';
// import existing theme
import '@vavt/cm-extension/dist/previewTheme/arknights.css';
// import existing language
import ZH_TW from '@vavt/cm-extension/dist/locale/zh-TW';

config({
  editorConfig: {
    languageUserDefined: {
      'zh-TW': ZH_TW
    }
  }
});

export default () => {
  return <MdEditor language="zh-TW" previewTheme="arknights" />;
};

@vavt/v3-extension

This is the extension component library for md-editor-v3

yarn add @vavt/v3-extension

components

Name Description
Emoji Insert emoji into the editor
Mark Text markers<mark>
OriginalImg Insert <img src="" alt="" width="100%">
ExportPDF Export content as a PDF file

@vavt/rt-extension

This is the extension component library for md-editor-rt

yarn add @vavt/rt-extension

components

Name Description
Emoji Insert emoji into the editor
Mark Text markers<mark>
OriginalImg Insert <img src="" alt="" width="100%">
ExportPDF Export content as a PDF file

Contribute

  • Fork the repository.
  • Write code based on existing templates.
  • Submit a pull request to the project owner.

Please note that the development environment of @vavt/cm-extension has automatically introduced your language configuration and theme. You do not need to manually reference it in the 'dev' directory. Regardless of the production or development environment, you only need to pay attention to the content of the language configuration and theme itself.

Language

Create a file named as [language name].js, and export in the following template.

import type { StaticTextDefaultValue } from '../../index';

/**
 * @author imzbf
 * @email  [email protected]
 * @github https://github.com/imzbf
 *
 * English
 */
const EN_US: StaticTextDefaultValue = {
  toolbarTips: {
    bold: 'bold',
    underline: 'underline',
    italic: 'italic',
    strikeThrough: 'strikeThrough',
    title: 'title',
    sub: 'subscript',
    sup: 'superscript',
    quote: 'quote',
    unorderedList: 'unordered list',
    orderedList: 'ordered list',
    task: 'task list',
    codeRow: 'inline code',
    code: 'block-level code',
    link: 'link',
    image: 'image',
    table: 'table',
    mermaid: 'mermaid',
    katex: 'formula',
    revoke: 'revoke',
    next: 'undo revoke',
    save: 'save',
    prettier: 'prettier',
    pageFullscreen: 'fullscreen in page',
    fullscreen: 'fullscreen',
    preview: 'preview',
    previewOnly: 'preview only',
    htmlPreview: 'html preview',
    catalog: 'catalog',
    github: 'source code'
  },
  titleItem: {
    h1: 'Lv1 Heading',
    h2: 'Lv2 Heading',
    h3: 'Lv3 Heading',
    h4: 'Lv4 Heading',
    h5: 'Lv5 Heading',
    h6: 'Lv6 Heading'
  },
  imgTitleItem: {
    link: 'Add Img Link',
    upload: 'Upload Img',
    clip2upload: 'Clip Upload'
  },
  linkModalTips: {
    title: 'Add ',
    descLabel: 'Desc:',
    descLabelPlaceHolder: 'Enter a description...',
    urlLabel: 'Link:',
    urlLabelPlaceHolder: 'Enter a link...',
    buttonOK: 'OK'
  },
  clipModalTips: {
    title: 'Crop Image',
    buttonUpload: 'Upload'
  },
  copyCode: {
    text: 'Copy',
    successTips: 'Copied!',
    failTips: 'Copy failed!'
  },
  mermaid: {
    flow: 'flow',
    sequence: 'sequence',
    gantt: 'gantt',
    class: 'class',
    state: 'state',
    pie: 'pie',
    relationship: 'relationship',
    journey: 'journey'
  },
  katex: {
    inline: 'inline',
    block: 'block'
  },
  footer: {
    markdownTotal: 'Word Count',
    scrollAuto: 'Scroll Auto'
  }
};

export default EN_US;

PreviewTheme

Create a file named as [theme name].scss, then write your theme code:

@import '../../common/index.scss';

.xxx-theme {
  @include common-style;
  color: red;
}

xxx is the name of your theme, use like previewTheme="xxx".

You can make full use of the existing css variables to generate your theme.

About

Common extensions for md-editor-v3 and md-editor-rt.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 59.7%
  • SCSS 29.1%
  • JavaScript 5.4%
  • Vue 4.2%
  • Other 1.6%