mirror of
https://github.com/go-gitea/gitea
synced 2025-07-09 20:17:21 +00:00
Refactor markup render system (#32589)
This PR mainly moves some code and introduces `RenderContext.WithXxx` functions
This commit is contained in:
@ -180,17 +180,16 @@ func prepareOrgProfileReadme(ctx *context.Context, viewRepositories bool) bool {
|
||||
if bytes, err := profileReadme.GetBlobContent(setting.UI.MaxDisplayFileSize); err != nil {
|
||||
log.Error("failed to GetBlobContent: %v", err)
|
||||
} else {
|
||||
if profileContent, err := markdown.RenderString(&markup.RenderContext{
|
||||
Ctx: ctx,
|
||||
GitRepo: profileGitRepo,
|
||||
Links: markup.Links{
|
||||
if profileContent, err := markdown.RenderString(markup.NewRenderContext(ctx).
|
||||
WithGitRepo(profileGitRepo).
|
||||
WithLinks(markup.Links{
|
||||
// Pass repo link to markdown render for the full link of media elements.
|
||||
// The profile of default branch would be shown.
|
||||
Base: profileDbRepo.Link(),
|
||||
BranchPath: path.Join("branch", util.PathEscapeSegments(profileDbRepo.DefaultBranch)),
|
||||
},
|
||||
Metas: markup.ComposeSimpleDocumentMetas(),
|
||||
}, bytes); err != nil {
|
||||
}).
|
||||
WithMetas(markup.ComposeSimpleDocumentMetas()),
|
||||
bytes); err != nil {
|
||||
log.Error("failed to RenderString: %v", err)
|
||||
} else {
|
||||
ctx.Data["ProfileReadme"] = profileContent
|
||||
|
Reference in New Issue
Block a user