Fix markdown rendering when mentioning users (#30795)

This commit is contained in:
wxiaoguang 2024-05-02 09:00:46 +08:00 committed by GitHub
parent 6f7cd94a02
commit ce08a9fe2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 10 deletions

View file

@ -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)))
}