aboutsummaryrefslogtreecommitdiffstats
path: root/services/markup
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-11-24 16:18:57 +0800
committerGitHub <noreply@github.com>2024-11-24 16:18:57 +0800
commit633785a5f3fe00789a6cba7cc0db1333de1e9c52 (patch)
tree2a2703ee9ed41c9caa508bd72c3fb5b52716af16 /services/markup
parentfa175c16949f09757ae85db6697cec327c44cba9 (diff)
downloadgitea-633785a5f3fe00789a6cba7cc0db1333de1e9c52.tar.gz
gitea-633785a5f3fe00789a6cba7cc0db1333de1e9c52.zip
Refactor markup render system (#32612)
This PR removes (almost) all path tricks, and introduces "renderhelper" package. Now we can clearly see the rendering behaviors for comment/file/wiki, more details are in "renderhelper" tests. Fix #31411 , fix #18592, fix #25632 and maybe more problems. (ps: fix #32608 by the way)
Diffstat (limited to 'services/markup')
-rw-r--r--services/markup/processorhelper.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/services/markup/processorhelper.go b/services/markup/processorhelper.go
index 68487fb8db..1f1abf496a 100644
--- a/services/markup/processorhelper.go
+++ b/services/markup/processorhelper.go
@@ -11,10 +11,8 @@ import (
gitea_context "code.gitea.io/gitea/services/context"
)
-func ProcessorHelper() *markup.ProcessorHelper {
- return &markup.ProcessorHelper{
- ElementDir: "auto", // set dir="auto" for necessary (eg: <p>, <h?>, etc) tags
-
+func ProcessorHelper() *markup.RenderHelperFuncs {
+ return &markup.RenderHelperFuncs{
RenderRepoFileCodePreview: renderRepoFileCodePreview,
IsUsernameMentionable: func(ctx context.Context, username string) bool {
mentionedUser, err := user.GetUserByName(ctx, username)