From 405a9c309fcd8f1e38bd7eeaa7203b4d7f69c122 Mon Sep 17 00:00:00 2001 From: Minho Date: Tue, 27 Feb 2018 13:25:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE=E6=A6=82?= =?UTF-8?q?=E8=BF=B0=E4=B8=8D=E8=A7=A3=E6=9E=90Markdown=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/book.go | 2 ++ views/book/dashboard.tpl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/book.go b/controllers/book.go index 06ce4044..c720cd02 100644 --- a/controllers/book.go +++ b/controllers/book.go @@ -22,6 +22,7 @@ import ( "github.com/lifei6671/mindoc/utils/pagination" "net/http" "github.com/lifei6671/mindoc/converter" + "github.com/russross/blackfriday" ) type BookController struct { @@ -76,6 +77,7 @@ func (c *BookController) Dashboard() { c.Abort("500") } + c.Data["Description"] = template.HTML(blackfriday.MarkdownBasic([]byte(book.Description))) c.Data["Model"] = *book } diff --git a/views/book/dashboard.tpl b/views/book/dashboard.tpl index 53be209d..2cf80260 100644 --- a/views/book/dashboard.tpl +++ b/views/book/dashboard.tpl @@ -92,7 +92,7 @@ 文档标签: {{.Model.Label}} -
{{.Model.Description}}
+
{{.Description}}