diff --git a/main.go b/main.go index 7c9f806..a3a1fd9 100755 --- a/main.go +++ b/main.go @@ -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) diff --git a/templates/view.tmpl b/templates/view.tmpl new file mode 100755 index 0000000..9f7ddb2 --- /dev/null +++ b/templates/view.tmpl @@ -0,0 +1,346 @@ + + + + + {{ .Title }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ .Body }} +
+ + + + +