mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor markup render system (#32589)
This PR mainly moves some code and introduces `RenderContext.WithXxx` functions
This commit is contained in:
@@ -267,15 +267,12 @@ func UpdateCommentContent(ctx *context.Context) {
|
||||
|
||||
var renderedContent template.HTML
|
||||
if comment.Content != "" {
|
||||
renderedContent, err = markdown.RenderString(&markup.RenderContext{
|
||||
Links: markup.Links{
|
||||
Base: ctx.FormString("context"), // FIXME: <- IS THIS SAFE ?
|
||||
},
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(ctx),
|
||||
GitRepo: ctx.Repo.GitRepo,
|
||||
Repo: ctx.Repo.Repository,
|
||||
Ctx: ctx,
|
||||
}, comment.Content)
|
||||
renderedContent, err = markdown.RenderString(markup.NewRenderContext(ctx).
|
||||
WithLinks(markup.Links{Base: ctx.FormString("context")}).
|
||||
WithMetas(ctx.Repo.Repository.ComposeMetas(ctx)).
|
||||
WithGitRepo(ctx.Repo.GitRepo).
|
||||
WithRepoFacade(ctx.Repo.Repository),
|
||||
comment.Content)
|
||||
if err != nil {
|
||||
ctx.ServerError("RenderString", err)
|
||||
return
|
||||
|
Reference in New Issue
Block a user