Search results


In RichTextEditor, you click the toolbar buttons to format the words and the changes are visible immediately.

Markdown is not like that. When you format the word in Markdown format, you need to add Markdown syntax to the word to indicate which words and phrases should look different from each other RichTextEditor supports markdown editing when the editorMode set as markdown and using both keyboard interaction and toolbar action, you can apply the formatting to text.

Supported Tools

The editor’s toolbar contains commands to format the markdown content. The toolbar consists of:

Tools Description
Lists Ordered and unordered list types.
Links A hyperlink can be inserted into the editor for quick access to related information.
Image Inserts and manages images.
Alignment Aligns the content with left, center, and right margins.
Format Formats the sentence in different ways such as heading level, quotation, and code snippet.
Styles Allows you to apply inline styles to the selected content like bold, italic, and more.

Markdown to HTML

The rich text editor allows you to preview markdown changes immediately using preview. The third-party library Marked is used in this sample to convert markdown into HTML content.

This sample demonstrates how to preview markdown changes in rich text editor. Type or edit the display text and apply format to view the preview of markdown.

<div class="control-wrapper">
<div class="control-section">
    @Html.EJS().RichTextEditor("markdown").ToolbarSettings(e => e.Items((object)ViewBag.items)).Value((string)ViewBag.value).Created("created").Render()
<script src=""></script>
<script type="text/javascript">
    var mdsource, defaultRTE, textArea;
    function created() {
        defaultRTE = this;
        textArea = defaultRTE.contentModule.getEditPanel();
        textArea.addEventListener('keyup', (event) => { markDownConversion(); });
        var rteObj = defaultRTE;
        mdsource = document.getElementById('preview-code');
        mdsource.addEventListener('click', (event) => {
            fullPreview({ mode: true, type: 'preview' });
            if ((event.currentTarget).classList.contains('e-active')) {
                defaultRTE.disableToolbarItem(['Bold', 'Italic', 'StrikeThrough', '|',
                    'Formats', 'OrderedList', 'UnorderedList', '|',
                    'CreateLink', 'Image', 'Undo', 'Redo']);
            } else {
                defaultRTE.enableToolbarItem(['Bold', 'Italic', 'StrikeThrough', '|',
                    'Formats', 'OrderedList', 'UnorderedList', '|',
                    'CreateLink', 'Image', 'Undo', 'Redo']);
    function markDownConversion() {
        if (mdsource.classList.contains('e-active')) {
            var id = defaultRTE.getID() + 'html-preview';
            var htmlPreview = defaultRTE.element.querySelector('#' + id);
            var rteElement = defaultRTE.contentModule.getEditPanel();
            var rteValue = rteElement.value;
            htmlPreview.innerHTML = marked(defaultRTE.value);
    function fullPreview(event) {
        var id = defaultRTE.getID() + 'html-preview';
        htmlPreview = defaultRTE.element.querySelector('#' + id);
        if (mdsource.classList.contains('e-active')) {
            mdsource.parentElement.title = 'Preview';
   = 'block';
   = '100%';
   = 'none';
        } else {
            if (!htmlPreview) {
                htmlPreview = ej.base.createElement('div', { className: 'e-content' });
       = id;
            if (event.type === 'preview') {
       = 'none'; htmlPreview.classList.add('e-pre-source');
            } else {
       = '50%';
   = 'block';
            mdsource.parentElement.title = 'Code View';
.e-richtexteditor textarea.e-content {
    float: left;
    border-right: 1px solid rgba(0, 0, 0, 0.12);

.e-richtexteditor .e-rte-content .e-content {
    min-height: 150px;

.e-richtexteditor .e-rte-content {
    overflow: hidden;

.e-icon-btn.e-active .e-md-preview::before {
    content: '\e350';

.e-icon-btn .e-md-preview::before {
    content: '\e345';

.e-rte-content .e-content {
    float: right;
    overflow: auto;
    height: inherit;
    padding: 8px;
    height: 100%;

    .e-rte-content .e-content.e-pre-source {
        width: 100%;

.highcontrast .e-richtexteditor textarea.e-content {
    border-right: 1px solid #fff;