Unparsables Style *

This online demo demonstrates the import, paste and export Markdown features of RadEditor.

Import Markdown content to the editor

The makeHtml() client-side method of the Telerik.Web.UI.Editor.Markdown.Converter() object handles the Markdown import feature. Once converted the markdown content can be set in RadEditor via the set_html() method of the control, e.g.

//get a reference to RadEditorvar editor = $find("<%=RadEditor1.ClientID%>");//get a reference to the textbox with the Markdown contentvar textbox = $get("<%=MarkdownTextBox1.ClientID%>");//create an instance of the Markdown convertervar converter = new Telerik.Web.UI.Editor.Markdown.Converter();//set the converted Markdown content in the editoreditor.set_html(converter.makeHtml(textbox.value));

Paste Markdown content via the Paste Markdown dialog

The inserted markdown content via the Paste Markdown dialog is converted to valid HTML content. To enable the popup button on the toolbar add the
<tool name="PasteMarkdown"/> tag in the ToolsFile.xml file or register the button inline or via the codebehind as shown in the following help article: Adding Standard Buttons.

Export RadEdtor's content to a TXT file with markdown content

The approach is very straight-forward - to export the editor content to a text file with markdown format fire the ExportToMarkdown() server-side method.

You may also need to configure the exporting settings for the editor through the RadEditor.ExportSettings section. The available properties are:

FileName - a string specifying the name (without the extension) of the file that will be created. The file extension is automatically added based on the method that is used.

OpenInNewWindow - open the exported Markdown in a new instead of the same page