Explorar o código

Convert newlines to <br> in whatsapp->matrix formatted messages

Tulir Asokan %!s(int64=6) %!d(string=hai) anos
pai
achega
7f0a0df7de
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      formatting.go

+ 1 - 0
formatting.go

@@ -126,6 +126,7 @@ func (formatter *Formatter) ParseWhatsApp(content *mautrix.Content) {
 		output = regex.ReplaceAllStringFunc(output, replacer)
 	}
 	if output != content.Body {
+		output = strings.Replace(output, "\n", "<br/>", -1)
 		content.FormattedBody = output
 		content.Format = mautrix.FormatHTML
 		for regex, replacer := range formatter.waReplFuncText {