]> source.dussan.org Git - gitea.git/commit
Refactor render system (#32492)
authorwxiaoguang <wxiaoguang@gmail.com>
Thu, 14 Nov 2024 05:02:11 +0000 (13:02 +0800)
committerGitHub <noreply@github.com>
Thu, 14 Nov 2024 05:02:11 +0000 (05:02 +0000)
commit3f9c3e7bc394c115ccc4818d6505f1f68de350d2
treee07e4a3dc07ce80104f7949af5cb180b7fce449e
parent985e2a8af3d6468bac3ab178148c38bdbd8414f5
Refactor render system (#32492)

There were too many patches to the Render system, it's really difficult
to make further improvements.

This PR clears the legacy problems and fix TODOs.

1. Rename `RenderContext.Type` to `RenderContext.MarkupType` to clarify
its usage.
2. Use `ContentMode` to replace `meta["mode"]` and `IsWiki`, to clarify
the rendering behaviors.
3. Use "wiki" mode instead of "mode=gfm + wiki=true"
4. Merge `renderByType` and `renderByFile`
5. Add more comments

----

The problem of "mode=document": in many cases it is not set, so many
non-comment places use comment's hard line break incorrectly
32 files changed:
models/repo/repo.go
modules/markup/console/console.go
modules/markup/html.go
modules/markup/html_codepreview_test.go
modules/markup/html_internal_test.go
modules/markup/html_issue.go
modules/markup/html_link.go
modules/markup/html_node.go
modules/markup/html_test.go
modules/markup/markdown/goldmark.go
modules/markup/markdown/markdown.go
modules/markup/markdown/markdown_test.go
modules/markup/markdown/transform_image.go
modules/markup/orgmode/orgmode.go
modules/markup/orgmode/orgmode_test.go
modules/markup/render.go
modules/structs/miscellaneous.go
modules/templates/util_render.go
modules/templates/util_render_test.go
routers/api/v1/misc/markup.go
routers/api/v1/misc/markup_test.go
routers/common/markup.go
routers/web/feed/convert.go
routers/web/misc/markup.go
routers/web/repo/view.go
routers/web/repo/wiki.go
routers/web/user/profile.go
services/context/org.go
templates/swagger/v1_json.tmpl
tests/integration/markup_external_test.go
web_src/js/features/comp/ComboMarkdownEditor.ts
web_src/js/features/repo-wiki.ts