官方地址 https://bh-lay.github.io/mditor/javascript
##使用方法html
#1.頁面添加domjava
```javascriptjquery
<textarea id="md_editor">……</textarea>
```git
#2.引入js文件或者Npm安裝後requiregithub
```javascriptmarkdown
<script type="text/javascript" src="src/jquery.js"></script> <script type="text/javascript" src="src/mditor.js"></script> <script type="text/javascript"> //獲取textarea dom對象 var ele_textarea = document.getElementById('md_editor'); //實例化Mditor var editor = new mditor(ele_textarea); </script>
```dom
#3.高級操做ui
```javascriptspa
var editor = new mditor(document.getElementById('md_editor'),{
//自定義顯示class
previewclass:'md_test'
})
```
//獲取html
```javascript
editor.getHtml()
```
//獲取markdown
```javascript
editor.getContent()
```
//插入內容
```javascript
editor.inset('插入inner');
```
//進入預覽
```javascript
editor.preview();
```
//返回編輯界面
```javascript
editor.edit();
```