diff --git a/modules/markup/html.go b/modules/markup/html.go index 41248654d8..bef6269a69 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -481,6 +481,7 @@ func createCustomEmoji(alias, class string) *html.Node { Attr: []html.Attribute{}, } if class != "" { + img.Attr = append(img.Attr, html.Attribute{Key: "alt", Val: fmt.Sprintf(`:%s:`, alias)}) img.Attr = append(img.Attr, html.Attribute{Key: "src", Val: fmt.Sprintf(`%s/img/emoji/%s.png`, setting.StaticURLPrefix, alias)}) } diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index 69c4e675f5..7f820d3990 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -255,7 +255,7 @@ func TestRender_emoji(t *testing.T) { //Text that should be turned into or recognized as emoji test( ":gitea:", - `

`) + `

:gitea:

`) test( "Some text with 😄 in the middle", diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 718fe8f267..f86287f10b 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -607,7 +607,7 @@ func ReactionToEmoji(reaction string) template.HTML { if val != nil { return template.HTML(val.Emoji) } - return template.HTML(fmt.Sprintf(``, setting.StaticURLPrefix, reaction)) + return template.HTML(fmt.Sprintf(`:%s:`, reaction, setting.StaticURLPrefix, reaction)) } // RenderNote renders the contents of a git-notes file as a commit message. diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 850c5b9157..39468ee6b2 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -218,7 +218,7 @@ {{.Poster.GetDisplayName}} - {{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|Escape) (.NewTitle|Escape) $createdStr | Safe}} + {{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}} {{else if eq .Type 11}} diff --git a/web_src/js/features/emoji.js b/web_src/js/features/emoji.js index 3c24a165b9..51d8801dc8 100644 --- a/web_src/js/features/emoji.js +++ b/web_src/js/features/emoji.js @@ -24,7 +24,7 @@ for (const key of emojiKeys) { export function emojiHTML(name) { let inner; if (name === 'gitea') { - inner = `:${name}:`; + inner = `:${name}:`; } else { inner = emojiString(name); }