chore: introduce HTMLBuilder#37688
Merged
Merged
Conversation
5295cf3 to
c89901d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces new HTML helper APIs (HTMLPrintf usage patterns plus a new HTMLBuilder) and refactors a few call sites to write escaped HTML directly to an io.Writer rather than allocating intermediate strings.
Changes:
- Add
htmlutil.EscapeStringand a fluenthtmlutil.HTMLBuilderwith tests. - Replace some
HTMLFormat+Write([]byte(...))patterns withhtmlutil.HTMLPrintf(...). - Minor internal rendering refactor to use
io.WriteStringwhen outputtingtemplate.HTML.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| routers/web/repo/view_home.go | Switches only_content submodule response to emit meta-refresh via HTMLPrintf. |
| modules/web/router.go | Uses HTMLPrintf for a 404 HTML response body. |
| modules/markup/orgmode/orgmode.go | Replaces a small local helper with direct HTMLPrintf calls for links/media. |
| modules/markup/internal/renderinternal.go | Writes protected HTML via io.WriteString instead of []byte(...). |
| modules/htmlutil/html.go | Adds EscapeString and the new HTMLBuilder type. |
| modules/htmlutil/html_test.go | Adds unit coverage for HTMLBuilder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
silverwind
approved these changes
May 13, 2026
bircni
approved these changes
May 13, 2026
Member
|
@wxiaoguang isn't it a refactor? |
Contributor
Author
|
Too trivial to appear in the changelog |
silverwind
added a commit
to bircni/gitea
that referenced
this pull request
May 14, 2026
…thor * origin/main: [skip ci] Updated translations via Crowdin fix: snap build (main branch) (go-gitea#37685) chore: introduce HTMLBuilder (go-gitea#37688) chore: clean up "contrib" dir (go-gitea#37690) feat(api): add sort and order query parameters to job list endpoints (go-gitea#37672) fix: Sort action run jobs by JobID and Name with matrix examples (go-gitea#37046) fix: catch and fix more lint problems (go-gitea#37674) docs(agents): update AGENTS.md (go-gitea#37684) fix(actions): run `TransferLogs` on `UpdateLog{Rows:[], NoMore:true}` (go-gitea#37631)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.