Installation configuration
You need to install configuration Golang and then install Configuration Beego, which beego is a way to use Go thinking to help you
Build and develop an open-source web development framework for Go applications, beego with friendly Chinese documents, see Beego
After the installation configuration is complete, use the bee command to create the project
Description: Using Beego framework Development, background database is MongoDB, edit is Mardkdown
bee new blog// 目录结构如下├─conf├─controllers├─models├─routers├─static│ ├─css│ ├─img│ └─js├─tests└─views
Use bee run , please open it in the browser 127.0.0.1:8080 to see the effect
Markdown Editor
Use Simplemde to customize the personal Markdown Editor, SimpleMDE refer to this article for related configuration
beegoFramework default support suffix Yes tpl and html template
- Create editor.html in views
- Introducing in Static
simplemde.min.css
For simplemde.min.css a little makeover, add a title and publish button, default full screen and display the preview screen,SimpleMDE
The core configuration is as follows:
var simplemde = new SimpleMDE({ element: document.getElementById("editor"), status: false, autoDownloadFontAwesome: false, tabSize: 4, renderingConfig: { codeSyntaxHighlighting: true }, }); simplemde.toggleSideBySide();
To add a Editor controller
controllersAdd a file ineditor.go
package controllersimport "github.com/astaxie/beego"type EditorController struct { beego.Controller}func (this *EditorController) Get() { this.TplName = "editor.html"}
Add the corresponding route
routers/router.goadd a route map in
beego.Router("/editor", &controllers.EditorController{})
Enter an address in the browser to 127.0.0.1:8080/editor see the effect
Full source