Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
tui-editor
Advanced tools
GFM Markdown WYSIWYG Editor - Productive and Extensible
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.
var options = {
...
usageStatistics: false
}
var editor = new Editor(options);
Or, include tui-code-snippet.js
(v1.4.0 or later) and then immediately write the options as follows:
tui.usageStatistics = false;
Chrome | Internet Explorer | Edge | Safari | Firefox |
---|---|---|---|---|
Yes | 10+ | Yes | Yes | Yes |
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 respects 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.
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:
To learn more about Extensions check the Using Extension
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.
npm install --save tui-editor
bower install --save tui-editor
TOAST UI products are available over the CDN powered by TOAST Cloud.
You can use the CDN as below.
<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.33.0/codemirror.css"></link>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css"></link>
<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/
│ ├─ ...
The code provided underneath is for npm + bundler. If you are using bower please see Getting started with bower.
Place a <div></div>
where you want TOAST UI Editor rendered.
<body>
...
<div id="editSection"></div>
...
</body>
Add dependencies & initialize Editor class with given element to make an Editor.
// deps for editor
require('codemirror/lib/codemirror.css'); // codemirror
require('tui-editor/dist/tui-editor.css'); // editor ui
require('tui-editor/dist/tui-editor-contents.css'); // editor content
require('highlight.js/styles/github.css'); // code block highlight
var Editor = require('tui-editor');
...
var editor = new Editor({
el: document.querySelector('#editSection'),
initialEditType: 'markdown',
previewStyle: 'vertical',
height: '300px'
});
or you can use jquery plugin.
$('#editSection').tuiEditor({
initialEditType: 'markdown',
previewStyle: 'vertical',
height: '300px'
});
or if using the CDN
var editor = new tui.Editor({
el: document.querySelector('#editSection'),
initialEditType: 'markdown',
previewStyle: 'vertical',
height: '300px'
});
300px
| auto
markdown
| wysiwyg
tab
| vertical
true
| false
Find out more options here
TOAST UI Editor provides a Viewer in case you want to show Markdown content without loading the editor. The Viewer is much lighter than the editor.
// deps for viewer.
require('tui-editor/dist/tui-editor-contents.css'); // editor content
require('highlight.js/styles/github.css'); // code block highlight
var Viewer = require('tui-editor/dist/tui-editor-Viewer');
...
var editor = new Viewer({
el: document.querySelector('#viewerSection'),
height: '500px',
initialValue: '# content to be rendered'
});
...
Be careful not to load both the editor and the viewer at the same time because the editor already contains the viewer function, you can initialize editor Editor.factory() and set the viewer
option to value true
in order to make the editor a viewer. You can also call getHTML() to render the HTML.
var Editor = require('tui-editor');
...
var editor = Editor.factory({
el: document.querySelector('#viewerSection'),
viewer: true,
height: '500px',
initialValue: '# content to be rendered'
});
...
TOAST UI Editor respects CommonMark and GFM. So any Markdown renderer including markdownit can handle the content made using TOAST UI Editor. You can also use any of these renderer in place of TOAST UI Editor Viewer.
FAQs
GFM Markdown Wysiwyg Editor - Productive and Extensible
The npm package tui-editor receives a total of 2,694 weekly downloads. As such, tui-editor popularity was classified as popular.
We found that tui-editor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.