1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
This commit is contained in:
Zack Scholl
2016-02-06 23:26:08 -05:00
parent 205235c4ea
commit 29bc3f6350
2 changed files with 351 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"html/template"
"log"
"net/http"
"os"
@@ -150,7 +151,10 @@ func main() {
unsafe := blackfriday.MarkdownCommon([]byte(p.Text))
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
c.Data(200, "text/html", html)
c.HTML(http.StatusOK, "view.tmpl", gin.H{
"Title": title,
"Body": template.HTML(html),
})
} else {
c.Redirect(302, "/"+title)