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