summaryrefslogtreecommitdiffstats
path: root/bridge/telegram/html.go
diff options
context:
space:
mode:
authorAlexander <korelskiy@uteka.ru>2022-07-07 01:47:50 +0300
committerGitHub <noreply@github.com>2022-07-07 00:47:50 +0200
commit3c4192ebf6a32e30cdd23a9644c2ceca72a006fa (patch)
tree373cfeb626ea484acf031e5752d73ac2219d309b /bridge/telegram/html.go
parente450e1c44773fea833ffa6d7f0a98eb696017689 (diff)
downloadmatterbridge-msglm-3c4192ebf6a32e30cdd23a9644c2ceca72a006fa.tar.gz
matterbridge-msglm-3c4192ebf6a32e30cdd23a9644c2ceca72a006fa.tar.bz2
matterbridge-msglm-3c4192ebf6a32e30cdd23a9644c2ceca72a006fa.zip
Fix message html entities escaping when sending to Telegram (#1855)
Diffstat (limited to 'bridge/telegram/html.go')
-rw-r--r--bridge/telegram/html.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/bridge/telegram/html.go b/bridge/telegram/html.go
index 41326f6f..4aa9fd3a 100644
--- a/bridge/telegram/html.go
+++ b/bridge/telegram/html.go
@@ -2,7 +2,6 @@ package btelegram
import (
"bytes"
- "html"
"github.com/russross/blackfriday"
)
@@ -24,10 +23,16 @@ func (options *customHTML) Paragraph(out *bytes.Buffer, text func() bool) {
func (options *customHTML) BlockCode(out *bytes.Buffer, text []byte, lang string) {
out.WriteString("<pre>")
- out.WriteString(html.EscapeString(string(text)))
+ out.WriteString(string(text))
out.WriteString("</pre>\n")
}
+func (options *customHTML) CodeSpan(out *bytes.Buffer, text []byte) {
+ out.WriteString("<code>")
+ out.WriteString(string(text))
+ out.WriteString("</code>")
+}
+
func (options *customHTML) Header(out *bytes.Buffer, text func() bool, level int, id string) {
options.Paragraph(out, text)
}
@@ -42,6 +47,10 @@ func (options *customHTML) BlockQuote(out *bytes.Buffer, text []byte) {
out.WriteByte('\n')
}
+func (options *customHTML) LineBreak(out *bytes.Buffer) {
+ out.WriteByte('\n')
+}
+
func (options *customHTML) List(out *bytes.Buffer, text func() bool, flags int) {
options.Paragraph(out, text)
}