mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-31 03:14:17 +09:00
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:
2 files changed
+20
-2
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user