Skip to content

Commit 409a188

Browse files
committed
bookstack auto
1 parent 09d29c3 commit 409a188

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

controllers/DocumentController.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,14 +1013,17 @@ func (this *DocumentController) Content() {
10131013
}
10141014

10151015
content = this.replaceLinks(identify, content, isSummary)
1016-
1017-
if isSummary || strings.Contains(markdown, "<bookstack-auto></bookstack-auto>") || strings.Contains(doc.Markdown, "<bookstack-auto/>") {
1016+
auto := strings.Contains(markdown, "<bookstack-auto></bookstack-auto>") || strings.Contains(doc.Markdown, "<bookstack-auto/>")
1017+
if isSummary || auto {
10181018
//自动生成文档内容
10191019
var imd, icont string
10201020
newDoc := models.NewDocument()
10211021
if strings.ToLower(doc.Identify) == "summary.md" {
1022-
//icont, _ = newDoc.CreateDocumentTreeForHtml(doc.BookId, doc.DocumentId)
1023-
imd = html2md.Convert(content)
1022+
if auto {
1023+
icont, _ = newDoc.CreateDocumentTreeForHtml(doc.BookId, doc.DocumentId)
1024+
} else {
1025+
imd = html2md.Convert(content)
1026+
}
10241027
imd = strings.Replace(imd, "(/read/"+identify+"/", "($", -1)
10251028
markdown = imd
10261029
} else {

0 commit comments

Comments
 (0)