Browse Source

修复项目概述不解析Markdown的BUG

Minho 7 years ago
parent
commit
405a9c309f
2 changed files with 3 additions and 1 deletions
  1. 2 0
      controllers/book.go
  2. 1 1
      views/book/dashboard.tpl

+ 2 - 0
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
 }
 

+ 1 - 1
views/book/dashboard.tpl

@@ -92,7 +92,7 @@
                         <span class="title">文档标签:</span>
                         <span class="body">{{.Model.Label}}</span>
                     </div>
-                        <div class="summary">{{.Model.Description}} </div>
+                        <div class="summary">{{.Description}} </div>
 
                     </div>
                 </div>