aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-05-02 09:00:46 +0800
committerGitHub <noreply@github.com>2024-05-02 01:00:46 +0000
commitce08a9fe2f7c9ae6390f1ad3d619524010a4e787 (patch)
treec831fee12cdf0104a7864e9ac37c9d492b4254e8 /modules/templates
parent6f7cd94a02aaf14bf2e2a6219bbc4379c4995b5d (diff)
downloadgitea-ce08a9fe2f7c9ae6390f1ad3d619524010a4e787.tar.gz
gitea-ce08a9fe2f7c9ae6390f1ad3d619524010a4e787.zip
Fix markdown rendering when mentioning users (#30795)
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/util_render_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/templates/util_render_test.go b/modules/templates/util_render_test.go
index 47c5da6485..f493b899e3 100644
--- a/modules/templates/util_render_test.go
+++ b/modules/templates/util_render_test.go
@@ -207,3 +207,8 @@ func TestRenderLabels(t *testing.T) {
expected = `/owner/repo/pulls?labels=123`
assert.Contains(t, RenderLabels(ctx, locale, []*issues.Label{label}, "/owner/repo", issue), expected)
}
+
+func TestUserMention(t *testing.T) {
+ rendered := RenderMarkdownToHtml(context.Background(), "@no-such-user @mention-user @mention-user")
+ assert.EqualValues(t, `<p>@no-such-user <a href="/mention-user" rel="nofollow">@mention-user</a> <a href="/mention-user" rel="nofollow">@mention-user</a></p>`, strings.TrimSpace(string(rendered)))
+}