TOAST UI Editor

Markdown WYSIWYG 编辑器。GFM 标准 + Chart 及 UML 扩展。「🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.」

Github stars Tracking Chart

tui-editor-bi

GFM Markdown WYSIWYG Editor - Productive and Extensible

github release version npm version license PRs welcome code with hearth by NHN

? Table of Contents

Collect Statistics on the Use of Open Source

TOAST UI Editor applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Editor is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. > “ui.toast.com") is to be collected and the sole purpose is nothing but to measure statistics on the usage. To disable GA, use the following usageStatistics options when creating editor.

const options = {
  // ...
  usageStatistics: false
}

const instance = new Editor(options);

Or, include tui-code-snippet(v1.5.0 or later) and then immediately write the options as follows:

tui.usageStatistics = false;

? Documents

Standard and Extensible

standard and extensible image

CommonMark + GFM Specifications

Today CommonMark is the de-facto Markdown standard. GFM (GitHub Flavored Markdown) is another popular specification based on CommonMark - maintained by GitHub, which is the Markdown mostly used. TOAST UI Editor follows both CommonMark and GFM specifications. Write documents with ease using productive tools provided by TOAST UI Editor and you can easily open the produced document wherever the specifications are supported.

Powerful Extensions

CommonMark and GFM are great, but we often need more abstraction. The TOAST UI Editor comes with powerful Extensions in compliance with the Markdown syntax. You also get the flexibility to develop your own extensions using simple APIs.

Here are some of the extensions you can start with:

  • Color Picker: ColorPicker provides an easy way to color text with a GUI tool box.
  • Chart Code Block: A code block marked as a 'chart' will render charts.
  • UML Code Block: A code block marked as an 'uml' will render UML diagrams.
  • Table Merge: You can merge columns and rows in tables.

To learn more about Extensions check the Using Extension.

? Features

TOAST UI Editor provides Markdown mode and WYSIWYG mode.

Depending on the type of use you want like production of Markdown or maybe to just edit the Markdown. The TOAST UI Editor can be helpful for both the usage. It offers Markdown mode and WYSIWYG mode, which can be switched any point in time.

Productive Markdown Mode

markdown image

  • Live Preview: Edit Markdown while keeping an eye on the rendered HTML. Your edits will be applied immediately.
  • Scrolling Sync: Synchronous scrolling between Markdown and Preview. You don't need to scroll through each one separately.
  • Auto Indent: The cursor will always be where you want it to be.
  • Syntax Highlight: You can check broken Markdown syntax immediately.

Easy WYSIWYG Mode

wysiwyg image

  • Copy and Paste: Paste anything from browser, screenshot, excel, powerpoint, etc.
  • Codeblock Editor: Highlight 170+ languages with full size code editor.
  • Table: Hate the Markdown table? You can do everything with a mouse.

And More

  • i18n: English, Dutch, Korean, Japanese, Chinese, Spanish, German, Russian, French, Ukrainian, Turkish, Finnish, Czech, Arabic, Polish, Galician, Swedish, Italian, Norwegian + language you extend.
  • Viewer: Renders Markdown content with extensions

? Examples

? Install

TOAST UI products can be used by using the package manager or downloading the source directly. However, we highly recommend using the package manager.

Via Package Manager

TOAST UI products are registered in two package managers, npm and bower.
You can conveniently install it using the commands provided by the package manager. When using npm, be sure to use it in the environment Node.js is installed.

npm

$ npm install --save tui-editor # Latest version
$ npm install --save tui-editor@<version> # Specific version

Via Contents Delivery Network (CDN)

TOAST UI products are available over the CDN powered by TOAST Cloud.

You can use the CDN as below.

<!-- Styles -->
<link rel="stylesheet" href="https://uicdn.toast.com/tui-editor/latest/tui-editor.css"></link>
<link rel="stylesheet" href="https://uicdn.toast.com/tui-editor/latest/tui-editor-contents.css"></link>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.4/codemirror.css"></link>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css"></link>
<!-- Scripts -->
<script src="https://uicdn.toast.com/tui-editor/latest/tui-editor-Editor-full.js"></script>

If you want to use a specific version, use the tag name instead of latest in the url's path.

The CDN directory has the following structure.

tui-editor/
├─ latest/
│  ├─ tui-editor-Editor.js
│  ├─ tui-editor-Editor.min.js
│  └─ ...
├─ v1.1.0/
│  ├─ ...

Download Source Files

?️ Wrappers

? Usage

The code below shows an example of using ES6 in node environment. If you are using bower please see Getting Started with Bower.

Create Editor

HTML

Add the container element where TOAST UI Editor will be created.

<div id="editorSection"></div>

JavaScript

TOAST UI Editor can be used by creating an instance with the constructor function. To get the constructor function, you should import the module using one of the following ways depending on your environment.

const Editor = require('tui-editor'); /* CommonJS */
import Editor from 'tui-editor'; /* ES6 */

Then import styles of TOAST UI Editor and dependencies.

import 'tui-editor/dist/tui-editor.css'; // editor's ui
import 'tui-editor/dist/tui-editor-contents.css'; // editor's content
import 'codemirror/lib/codemirror.css'; // codemirror
import 'highlight.js/styles/github.css'; // code block highlight

Finally you can create an instance with options and call various API after creating an instance.

import 'codemirror/lib/codemirror.css';
import 'tui-editor/dist/tui-editor.css';
import 'tui-editor/dist/tui-editor-contents.css';
import 'highlight.js/styles/github.css';

import Editor from 'tui-editor';

const instance = new Editor({
  el: document.querySelector('#editorSection'),
  initialEditType: 'markdown',
  previewStyle: 'vertical',
  height: '300px'
});

instance.getHtml();

If you use jQuery plugin, you can use it as follows.

$('#editorSection').tuiEditor({
  initialEditType: 'markdown',
  previewStyle: 'vertical',
  height: '300px'
});

Default Options

  • height: Height in string or auto ex) 300px

Overview

Name With Ownernhn/tui.editor
Primary LanguageTypeScript
Program languageCSS (Language Count: 5)
PlatformWeb browsers
License:MIT License
Release Count172
Last Release Nameeditor@3.2.2 (Posted on )
First Release Namev0.0.1 (Posted on )
Created At2015-07-27 06:57:23
Pushed At2024-04-14 02:39:47
Last Commit At2023-02-17 16:55:43
Stargazers Count16.8k
Watchers Count227
Fork Count1.7k
Commits Count361
Has Issues Enabled
Issues Count1584
Issue Open Count516
Pull Requests Count823
Pull Requests Open Count58
Pull Requests Close Count737
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private
To the top