(telegram|matrix)fmt: mention formatting

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans
2024-08-05 14:40:55 -06:00
parent b539e5d63d
commit f56f520308
14 changed files with 123 additions and 59 deletions
+5 -1
View File
@@ -23,7 +23,11 @@ import (
)
func (m Mention) Format(message string) string {
return fmt.Sprintf(`<a href="%s">%s</a>`, m.MXID.URI().MatrixToURL(), m.Name)
if m.Username != "" {
return fmt.Sprintf(`<a href="%s">@%s</a>`, m.MXID.URI().MatrixToURL(), m.Username)
} else {
return fmt.Sprintf(`<a href="%s">%s</a>`, m.MXID.URI().MatrixToURL(), m.Name)
}
}
func (s Style) Format(message string) string {