安装配置

beegobeegobee

说明: 使用beego框架开发,后台数据库是 MongoDB,编辑是 Mardkdown

bee new blog
// 目录结构如下
├─conf
├─controllers
├─models
├─routers
├─static
│  ├─css
│  ├─img
│  └─js
├─tests
└─views
bee run127.0.0.1:8080

markdown编辑器

SimpleMDEbeegotplhtml
simplemde.min.css
simplemde.min.cssSimpleMDE
  var simplemde = new SimpleMDE({
        element: document.getElementById("editor"),
        status: false,
        autoDownloadFontAwesome: false,
        tabSize: 4,
        renderingConfig: {
            codeSyntaxHighlighting: true
        },
    });
  simplemde.toggleSideBySide();
Editor
controllerseditor.go
package controllers

import "github.com/astaxie/beego"

type EditorController struct {
    beego.Controller
}

func (this *EditorController) Get() {
    this.TplName = "editor.html"
}

添加对应的路由

routers/router.go
beego.Router("/editor", &controllers.EditorController{})
127.0.0.1:8080/editor