# web-editor-markdown
**Repository Path**: zengyong2020/web-editor-markdown
## Basic Information
- **Project Name**: web-editor-markdown
- **Description**: 基于 web 端的 Markdown 编辑器,支持协同编辑扩展和方便的插件扩展
- **Primary Language**: TypeScript
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 144
- **Forks**: 30
- **Created**: 2022-11-04
- **Last Updated**: 2024-12-11
## Categories & Tags
**Categories**: markdown-utils
**Tags**: None
## README
A markdown editor in browser, supports collaborative editing
## 💡 Web Editor Markdown
[web-editor-markdown](https://github.com/Ben-love-zy/web-editor-markdown.git) is a Markdown editor based on Web browser and real-time rendering like `Typora`. It is based on TypeScript and JavaScript, and does not rely on any third-party framework. It supports Chinese friendly and can be easily extended and connected to native JavaScript, Vue, React, Angular and other applications. It provides four rendering modes: `SOURCE`, `SOURCE_AND_PREVIEW`, `RENDER` and `PREVIEW`. If necessary, its underlying layer also supports the ability of collaborative editing and provides atomic `Operation` for extending collaborative editing.
### ✨ English Demo

### ✨ Chinese Demo

### 🛠️ Getting started
* install it
```shell
npm install web-editor-markdown --save
```
* use it
```ts
import { Editor, withUndoRedo } from "web-editor-markdown";
let editor = new Editor(document.getElementById('id'));
editor = withUndoRedo(editor); // UndoRedo Plugin
editor.insertTextAtCursor('**This is a bold text**\n> tips:You can switch source mode with `cmd+/`');
```
* others
```ts
import { EditorViewMode } from "web-editor-markdown";
editor.switchViewMode(EditorViewMode.PREVIEW); // switch rendering mode,(shortcut key: 'cmd+/')
console.log('content', editor.getContent());
```
* local source
```shell
npm install
npm start
```