forked from Gitlink/gitea_hat
更改:获取wiki详情内容实用blackfriday
This commit is contained in:
parent
15018595fe
commit
f625463cf9
|
@ -9,6 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"github.com/russross/blackfriday/v2"
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
|
@ -267,6 +268,7 @@ func GetWiki(ctx *context.APIContext) {
|
|||
IsWiki: true,
|
||||
}
|
||||
var buf strings.Builder
|
||||
content := blackfriday.Run(data)
|
||||
if err := markdown.Render(rctx, bytes.NewReader(data), &buf); err != nil {
|
||||
ctx.ServerError("markdown.Render", err)
|
||||
return
|
||||
|
@ -301,7 +303,7 @@ func GetWiki(ctx *context.APIContext) {
|
|||
},
|
||||
CommitCounts: commitsCount,
|
||||
MdContent: string(data),
|
||||
SimpleContent: buf.String(),
|
||||
SimpleContent: string(content),
|
||||
}
|
||||
ctx.JSON(http.StatusOK, wiki)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue