fix(markup): keep commit title emoji inside links (#39986)

Render emoji inside the default commit-title link so the whole title
remains clickable, including emoji-only titles. Explicit links and
mentions keep their own destinations.

Fixes https://github.com/go-gitea/gitea/issues/31873
This commit is contained in:
leo authored and GitHub committed 2026-10-26 15:27:42 +00:00
1 parent a397e92c80
commit 9e27bce945
2 files changed
+20 -2

No files matched your search

+3 -2
View File
@@ -153,8 +153,6 @@ func PostProcessCommitMessageSubject(ctx *RenderContext, defaultLink, content st
issueIndexPatternProcessor,
commitCrossReferencePatternProcessor,
hashCurrentPatternProcessor,
emojiShortCodeProcessor,
emojiProcessor,
linkProcessor,
}
@@ -175,6 +173,9 @@ func PostProcessCommitMessageSubject(ctx *RenderContext, defaultLink, content st
node.DataAtom = atom.A
node.Attr = []html.Attribute{{Key: "href", Val: defaultLink}, {Key: "class", Val: "muted title-full-link"}}
node.FirstChild, node.LastChild = ch, ch
for n := node.FirstChild; n != nil; {
n = visitNode(ctx, emojiProcessors, n)
}
})
rendered := postProcessHTML(ctx, procs, htmlutil.EscapeString(content))
return htmlutil.HTMLFormat(`<span class="title-full-link-hover">%s</span>`, rendered)