Browse Source

优化Markdown解析

Minho 7 năm trước cách đây
mục cha
commit
ffe5dced44
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      models/BookModel.go

+ 5 - 1
models/BookModel.go

@@ -620,7 +620,11 @@ func (book *Book) ImportBook(zipPath string) error {
 					return link
 				})
 
-				doc.Content = string(blackfriday.Run([]byte(doc.Markdown)))
+				doc.Content = string(blackfriday.Run([]byte(doc.Markdown),
+							blackfriday.WithExtensions(blackfriday.Tables),
+							blackfriday.WithExtensions(blackfriday.HeadingIDs),
+								blackfriday.WithExtensions(blackfriday.FencedCode),
+								blackfriday.WithExtensions(blackfriday.AutoHeadingIDs)))
 
 				doc.Version = time.Now().Unix()