diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 815cba6eecaf1..1dff0a2777a74 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -697,7 +697,7 @@ uid = UID webauthn = Two-Factor Authentication (Security Keys) public_profile = Public Profile -biography_placeholder = Tell us a little bit about yourself! (You can use Markdown) +biography_placeholder = Tell us a little bit about yourself! location_placeholder = Share your approximate location with others profile_desc = Control how your profile is show to other users. Your primary email address will be used for notifications, password recovery and web-based Git operations. password_username_disabled = Non-local users are not allowed to change their username. Please contact your site administrator for more details. diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go index eea539f6d9fb5..e8ca91f2faff7 100644 --- a/routers/web/org/projects.go +++ b/routers/web/org/projects.go @@ -16,6 +16,8 @@ import ( "code.gitea.io/gitea/models/unit" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/json" + "code.gitea.io/gitea/modules/markup" + "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/optional" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/templates" @@ -145,6 +147,10 @@ func RenderNewProject(ctx *context.Context) { ctx.Data["PageIsViewProjects"] = true ctx.Data["HomeLink"] = ctx.ContextUser.HomeLink() ctx.Data["CancelLink"] = ctx.ContextUser.HomeLink() + "/-/projects" + ctx.Data["ProjectMarkdownPreviewURL"] = fmt.Sprintf("%s/-/markup", ctx.ContextUser.HomeLink()) + ctx.Data["ProjectMarkdownPreviewContext"] = ctx.ContextUser.HomeLink() + ctx.Data["ProjectMarkdownPreviewMode"] = "markdown" + ctx.Data["ProjectMarkdownHideRepoButtons"] = true shared_user.RenderUserHeader(ctx) err := shared_user.LoadHeaderCount(ctx) @@ -260,6 +266,10 @@ func RenderEditProject(ctx *context.Context) { ctx.Data["HomeLink"] = ctx.ContextUser.HomeLink() ctx.Data["card_type"] = p.CardType ctx.Data["CancelLink"] = fmt.Sprintf("%s/-/projects/%d", ctx.ContextUser.HomeLink(), p.ID) + ctx.Data["ProjectMarkdownPreviewURL"] = fmt.Sprintf("%s/-/markup", ctx.ContextUser.HomeLink()) + ctx.Data["ProjectMarkdownPreviewContext"] = ctx.ContextUser.HomeLink() + ctx.Data["ProjectMarkdownPreviewMode"] = "markdown" + ctx.Data["ProjectMarkdownHideRepoButtons"] = true ctx.HTML(http.StatusOK, tplProjectsNew) } diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index fdeead57035a7..8aeafc47519e5 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -137,6 +137,10 @@ func RenderNewProject(ctx *context.Context) { ctx.Data["CardTypes"] = project_model.GetCardConfig() ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(unit.TypeProjects) ctx.Data["CancelLink"] = ctx.Repo.Repository.Link() + "/projects" + ctx.Data["ProjectMarkdownPreviewURL"] = fmt.Sprintf("%s/markup", ctx.Repo.Repository.Link()) + ctx.Data["ProjectMarkdownPreviewContext"] = ctx.Repo.Repository.Link() + ctx.Data["ProjectMarkdownPreviewMode"] = "comment" + ctx.Data["ProjectMarkdownHideRepoButtons"] = false ctx.HTML(http.StatusOK, tplProjectsNew) } @@ -240,6 +244,10 @@ func RenderEditProject(ctx *context.Context) { ctx.Data["card_type"] = p.CardType ctx.Data["redirect"] = ctx.FormString("redirect") ctx.Data["CancelLink"] = fmt.Sprintf("%s/projects/%d", ctx.Repo.Repository.Link(), p.ID) + ctx.Data["ProjectMarkdownPreviewURL"] = fmt.Sprintf("%s/markup", ctx.Repo.Repository.Link()) + ctx.Data["ProjectMarkdownPreviewContext"] = ctx.Repo.Repository.Link() + ctx.Data["ProjectMarkdownPreviewMode"] = "comment" + ctx.Data["ProjectMarkdownHideRepoButtons"] = false ctx.HTML(http.StatusOK, tplProjectsNew) } diff --git a/routers/web/web.go b/routers/web/web.go index 9f9a1bb0988e6..682c8aa0f6147 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -974,6 +974,8 @@ func registerRoutes(m *web.Router) { // end "/repo": create, migrate, search m.Group("/{username}/-", func() { + m.Post("/markup", web.Bind(structs.MarkupOption{}), misc.Markup) + if setting.Packages.Enabled { m.Group("/packages", func() { m.Get("", user.ListPackages) diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl index 62debfc0aefac..87c1b6d066fd4 100644 --- a/templates/org/settings/options.tmpl +++ b/templates/org/settings/options.tmpl @@ -22,9 +22,17 @@ -