summaryrefslogtreecommitdiffstats
path: root/modules/markup
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup')
-rw-r--r--modules/markup/html.go1
-rw-r--r--modules/markup/html_test.go2
2 files changed, 2 insertions, 1 deletions
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:",
- `<p><span class="emoji" aria-label="gitea"><img src="`+setting.StaticURLPrefix+`/img/emoji/gitea.png"/></span></p>`)
+ `<p><span class="emoji" aria-label="gitea"><img alt=":gitea:" src="`+setting.StaticURLPrefix+`/img/emoji/gitea.png"/></span></p>`)
test(
"Some text with 😄 in the middle",