HTML
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>Editor.md - 光年(Light Year Admin)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="http://lyear.itshubao.com/iframe/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="http://libs.itshubao.com//editor.md/css/editormd.min.css" />
<link href="http://lyear.itshubao.com/iframe/css/style.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header"><h4>Markdown 在线编辑器 Editor.md</h4></div>
<div class="card-body">
<div id="test-editor">
<textarea style="display:none;">[TOC]
#### Disabled options
- TeX (Based on KaTeX);
- Emoji;
- Task lists;
- HTML tags decode;
- Flowchart and Sequence Diagram;
#### Editor.md directory
editor.md/
lib/
css/
scss/
tests/
fonts/
images/
plugins/
examples/
languages/
editormd.js
...
```html
<!-- English -->
<script src="js/editor.md/languages/en.js"></script>
<!-- 繁體中文 -->
<script src="js/editor.md/languages/zh-tw.js"></script>
```
</textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="http://lyear.itshubao.com/iframe/js/jquery.min.js"></script>
<script src="http://libs.itshubao.com//editor.md/editormd.min.js"></script>
</body>
</html>
CSS
/*模板样式里面有一个css会影响editor.md的图标,这里重设下*/
.editormd .divider {
width: auto;
}
.editormd .divider:before,
.editormd .divider:after {
margin: 0px;
}
JavaScript
$(function() {
var editor = editormd("test-editor", {
// width : "100%",
height : "600",
path : "http://libs.itshubao.com/editor.md/lib/",
codeFold : true,
htmlDecode : 'iframe|on*', // 开启标签
imageUpload : true,
imageUploadURL : "http://example.itshubao.com/index/test/upload/type/editormd",
/*
上传的后台只需要返回一个 JSON 数据,结构如下:
{
success : 0 | 1, // 0 表示上传失败,1 表示上传成功
message : "提示的信息,上传成功或上传失败及错误信息等。",
url : "图片地址" // 上传成功时才返回
}
*/
});
});