diff --git a/modules/web/route.go b/modules/web/route.go index 77c411a97b..787521dfb0 100644 --- a/modules/web/route.go +++ b/modules/web/route.go @@ -9,6 +9,7 @@ import ( "reflect" "strings" + "code.gitea.io/gitea/modules/htmlutil" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/web/middleware" @@ -214,7 +215,9 @@ func (r *Router) normalizeRequestPath(resp http.ResponseWriter, req *http.Reques normalizedPath = "/" } else if !strings.HasPrefix(normalizedPath+"/", "/v2/") { // do not respond to other requests, to simulate a real sub-path environment - http.Error(resp, "404 page not found, sub-path is: "+setting.AppSubURL, http.StatusNotFound) + resp.Header().Add("Content-Type", "text/html; charset=utf-8") + resp.WriteHeader(http.StatusNotFound) + _, _ = resp.Write([]byte(htmlutil.HTMLFormat(`404 page not found, sub-path is: %s`, setting.AppSubURL, setting.AppSubURL))) return } normalized = true diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 8da7412ade..57d2d89c5a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2590,7 +2590,6 @@ diff.generated = generated diff.vendored = vendored diff.comment.add_line_comment = Add line comment diff.comment.placeholder = Leave a comment -diff.comment.markdown_info = Styling with markdown is supported. diff.comment.add_single_comment = Add single comment diff.comment.add_review_comment = Add comment diff.comment.start_review = Start review diff --git a/routers/web/web.go b/routers/web/web.go index 5ed046a983..e89d069449 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -485,6 +485,8 @@ func registerRoutes(m *web.Router) { m.Methods("GET, HEAD", "/*", public.FileHandlerFunc()) }, optionsCorsHandler()) + m.Post("/-/markup", reqSignIn, web.Bind(structs.MarkupOption{}), misc.Markup) + m.Group("/explore", func() { m.Get("", func(ctx *context.Context) { ctx.Redirect(setting.AppSubURL + "/explore/repos") diff --git a/templates/devtest/devtest-footer.tmpl b/templates/devtest/devtest-footer.tmpl index 1c755508a5..a1b3b86e5c 100644 --- a/templates/devtest/devtest-footer.tmpl +++ b/templates/devtest/devtest-footer.tmpl @@ -1,3 +1,3 @@ {{/* TODO: the devtest.js is isolated from index.js, so no module is shared and many index.js functions do not work in devtest.ts */}} -{{template "base/footer" dict}} +{{template "base/footer" ctx.RootData}} diff --git a/templates/devtest/devtest-header.tmpl b/templates/devtest/devtest-header.tmpl index a5910b96e6..ee08545640 100644 --- a/templates/devtest/devtest-header.tmpl +++ b/templates/devtest/devtest-header.tmpl @@ -1,2 +1,2 @@ -{{template "base/head" dict}} +{{template "base/head" ctx.RootData}} diff --git a/templates/devtest/gitea-ui.tmpl b/templates/devtest/gitea-ui.tmpl index 303421fe13..5b40268761 100644 --- a/templates/devtest/gitea-ui.tmpl +++ b/templates/devtest/gitea-ui.tmpl @@ -183,8 +183,7 @@

ComboMarkdownEditor

-
ps: no JS code attached, so just a layout
- {{template "shared/combomarkdowneditor" .}} + {{template "shared/combomarkdowneditor" dict "MarkdownPreviewContext" "/owner/path"}}

Tailwind CSS Demo

diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl index 62debfc0ae..3b817d068b 100644 --- a/templates/org/settings/options.tmpl +++ b/templates/org/settings/options.tmpl @@ -23,6 +23,7 @@
+ {{/* it is rendered as markdown, but the length is limited, so at the moment we do not use the markdown editor here */}}
diff --git a/templates/projects/new.tmpl b/templates/projects/new.tmpl index bd173b54bc..a936079c46 100644 --- a/templates/projects/new.tmpl +++ b/templates/projects/new.tmpl @@ -18,7 +18,16 @@
- + {{/* TODO: repo-level project and org-level project have different behaviros to render */}} + {{/* the "Repository" is nil when the project is org-level */}} + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewInRepo" $.Repository + "MarkdownPreviewContext" (Iif $.Repository "" .HomeLink) + "MarkdownPreviewMode" (Iif $.Repository "comment") + "TextareaName" "content" + "TextareaContent" .content + "TextareaPlaceholder" (ctx.Locale.Tr "repo.projects.description_placeholder") + )}}
{{if not .PageIsEditProjects}} diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 20e0c9db66..0f1458bfbf 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -240,8 +240,9 @@