代碼示例網址:http://pandao.github.io/editor.md/examples/index.html
引入文件
<link rel="stylesheet" href="/editor.md-master/css/editormd.css" /> <script src="/editor.md-master/editormd.min.js"></script>
htmlphp
<div id="editormd"> <textarea style="display:none;" name="Content"></textarea> </div>
jscss
var editor; editor = editormd("editormd", { width : "99%", height : "600px", autoHeightEnabled:true, path : '/editor.md-master/lib/', //theme : "dark", //previewTheme : "dark", //editorTheme : "pastel-on-dark", markdown : '', codeFold : true, //syncScrolling : false, saveHTMLToTextarea : true, // 保存 HTML 到 Textarea searchReplace : true, //watch : false, // 關閉實時預覽 htmlDecode : "style,script,iframe|on*", // 開啓 HTML 標籤解析,爲了安全性,默認不開啓 //toolbar : false, //關閉工具欄 //previewCodeHighlight : false, // 關閉預覽 HTML 的代碼塊高亮,默認開啓 emoji : true, taskList : true, tocm : true, // Using [TOCM] tex : true, // 開啓科學公式TeX語言支持,默認關閉 flowChart : true, // 開啓流程圖支持,默認關閉 sequenceDiagram : true, // 開啓時序/序列圖支持,默認關閉, //dialogLockScreen : false, // 設置彈出層對話框不鎖屏,全局通用,默認爲true //dialogShowMask : false, // 設置彈出層對話框顯示透明遮罩層,全局通用,默認爲true //dialogDraggable : false, // 設置彈出層對話框不可拖動,全局通用,默認爲true //dialogMaskOpacity : 0.4, // 設置透明遮罩層的透明度,全局通用,默認值爲0.1 //dialogMaskBgColor : "#000", // 設置透明遮罩層的背景顏色,全局通用,默認爲#fff imageUpload : true, imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"], imageUploadURL : "./php/upload.php", onload : function() { //console.log('onload', this); //this.fullscreen(); //this.unwatch(); //this.watch().fullscreen(); //this.setMarkdown("#PHP"); //this.width("100%"); //this.height(480); //this.resize("100%", 640); } });