aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/projects.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/projects.go')
-rw-r--r--routers/repo/projects.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/routers/repo/projects.go b/routers/repo/projects.go
index 96ef2c6c0c..eb0719995c 100644
--- a/routers/repo/projects.go
+++ b/routers/repo/projects.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
@@ -77,7 +78,14 @@ func Projects(ctx *context.Context) {
}
for i := range projects {
- projects[i].RenderedContent = string(markdown.Render([]byte(projects[i].Description), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas()))
+ projects[i].RenderedContent, err = markdown.RenderString(&markup.RenderContext{
+ URLPrefix: ctx.Repo.RepoLink,
+ Metas: ctx.Repo.Repository.ComposeMetas(),
+ }, projects[i].Description)
+ if err != nil {
+ ctx.ServerError("RenderString", err)
+ return
+ }
}
ctx.Data["Projects"] = projects
@@ -311,7 +319,14 @@ func ViewProject(ctx *context.Context) {
}
ctx.Data["LinkedPRs"] = linkedPrsMap
- project.RenderedContent = string(markdown.Render([]byte(project.Description), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas()))
+ project.RenderedContent, err = markdown.RenderString(&markup.RenderContext{
+ URLPrefix: ctx.Repo.RepoLink,
+ Metas: ctx.Repo.Repository.ComposeMetas(),
+ }, project.Description)
+ if err != nil {
+ ctx.ServerError("RenderString", err)
+ return
+ }
ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(models.UnitTypeProjects)
ctx.Data["Project"] = project