mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-26 16:39:24 +00:00
This uses our own gomatrix lib with the SendHTML function which adds HTML to formatted_body in matrix. golang-commonmark is used to convert markdown into valid HTML.
This commit is contained in:
@ -3,6 +3,7 @@ package bmatrix
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html"
|
||||
"mime"
|
||||
"regexp"
|
||||
"strings"
|
||||
@ -112,8 +113,8 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) {
|
||||
// Edit message if we have an ID
|
||||
// matrix has no editing support
|
||||
|
||||
// Post normal message
|
||||
resp, err := b.mc.SendText(channel, msg.Username+msg.Text)
|
||||
// Post normal message with HTML support (eg riot.im)
|
||||
resp, err := b.mc.SendHTML(channel, msg.Text, html.EscapeString(msg.Username)+helper.ParseMarkdown(msg.Text))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
Reference in New Issue
Block a user