2
0
mirror of https://github.com/42wim/matterbridge synced 2024-11-19 03:25:33 +00:00

Trim <p> and </p> tags (matrix). Closes #686 (#753)

This commit is contained in:
Wim 2019-03-03 00:29:29 +01:00 committed by GitHub
parent 723f8c5fd5
commit e955a056e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,7 +178,10 @@ func ClipMessage(text string, length int) string {
func ParseMarkdown(input string) string { func ParseMarkdown(input string) string {
md := markdown.New(markdown.XHTMLOutput(true), markdown.Breaks(true)) md := markdown.New(markdown.XHTMLOutput(true), markdown.Breaks(true))
return (md.RenderToString([]byte(input))) res := md.RenderToString([]byte(input))
res = strings.TrimPrefix(res, "<p>")
res = strings.TrimSuffix(res, "</p>\n")
return res
} }
// ConvertWebPToPNG convert input data (which should be WebP format to PNG format) // ConvertWebPToPNG convert input data (which should be WebP format to PNG format)