Markdown (EDITORMD) syntax parsing into HTML

Source: Internet
Author: User

We can see a Web page Editor--markdown on some websites;

This is a powerful rich text editor, before the use of their own web page encountered a little bit of a problem, and now share with you

After we have written the article is need to save the content to the database, if you want to save to the database to be changed later, then need to save to markdown language, if saved as HTML language by reverse parse into markdown this may not be very good

If saving to markdown involves removing the data from the database and parsing it into HTML, here's my resolution (I'm using EDITORMD):

  

First, you need to initialize the parser from the Markdown language to the HTML language:
Editormd.markdowntohtml ("Test-editormd", {    htmldecode      "Style,script,iframe",      emoji            true ,    taskList        true,    Tex             true,  / /  Default does not resolve    flowChart       true,  //  default does not resolve    true  // default does not resolve });

The second is the introduction of JS
<script src= "./examples/js/jquery.min.js" ></script><script src= "Lib/marked.min.js" ></script ><script src= "Lib/prettify.min.js" ></script><script src= "Lib/raphael.min.js" ></script ><script src= "Lib/underscore.min.js" ></script><script src= "Lib/sequence-diagram.min.js" > </script><script src= "Lib/flowchart.min.js" ></script><script src= "lib/ Jquery.flowchart.min.js "></script><script src="./editormd.js "></script>

   the introduction of the order can not be wrong or some JS object may not be initialized, these JS in the Editor.md Lib package already exists. There is the above "TEST-EDITORMD", in fact, is an ID in the HTML code, this is the content of the MD storage
<div style= "margin-left:100px" ><div id= "Test-editormd" > <textarea style= "display:none;" placeholder= "Markdown language" > #Editor .md</textarea>    </div>
At this point, all the steps have been completed, which allows the MD data in the database to be displayed in the page resolution

  

Markdown (EDITORMD) syntax parsing into HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.