Telerik Product and Version
|
All |
Supported Browsers and Platforms
|
All |
Components/Widgets used (JS frameworks, etc.)
|
markdown-js; html-md
|
PROJECT DESCRIPTION
You can find here a very easy approach to make RadEditor behave like an Markdown editor. Enabling end users to type Markdown syntax and see the output and at the same time using Design mode to create HTML and see the Markdown.
Implementation:
Essentially, you will need JavaScript library or libraries to actually handle the transformation from HTML to Markdown and vice verse. Here we choose to use the MIT licensed markdown-js and html-md libraries.
What you need further, is to create a custom content filter that will utilize the libraries to convert the HTML to Markdown when going to HTML mode (it will be renamed later). And from Markdown to HTML when going to Design.
Finally, you can tweak the HTML mode's button to render "Code" or "Markdown" instead of "HTML". To do so you can use the Localization files or change the Localization properties in the code behind.
C#
VB
You can find runnable pages for C# and VB that show the end result of the code above.