summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-02-02 18:35:43 +0100
committerGitHub <noreply@github.com>2020-02-02 18:35:43 +0100
commit585d1556c18abc8b259819847d05b2b088bee806 (patch)
tree73d6d1cfc888e07149ea71da0e30e378081c680f /bridge
parent748655587527875ea360822255a60a892b8c4953 (diff)
downloadmatterbridge-msglm-585d1556c18abc8b259819847d05b2b088bee806.tar.gz
matterbridge-msglm-585d1556c18abc8b259819847d05b2b088bee806.tar.bz2
matterbridge-msglm-585d1556c18abc8b259819847d05b2b088bee806.zip
Disable smartypants in markdown parser. Fixes #989, #983 (#993)
Diffstat (limited to 'bridge')
-rw-r--r--bridge/helper/helper.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go
index 66ba64cb..8d75a8ad 100644
--- a/bridge/helper/helper.go
+++ b/bridge/helper/helper.go
@@ -15,6 +15,7 @@ import (
"github.com/42wim/matterbridge/bridge/config"
"github.com/gomarkdown/markdown"
+ "github.com/gomarkdown/markdown/html"
"github.com/gomarkdown/markdown/parser"
"github.com/sirupsen/logrus"
)
@@ -181,7 +182,10 @@ func ClipMessage(text string, length int) string {
func ParseMarkdown(input string) string {
extensions := parser.HardLineBreak
markdownParser := parser.NewWithExtensions(extensions)
- parsedMarkdown := markdown.ToHTML([]byte(input), markdownParser, nil)
+ renderer := html.NewRenderer(html.RendererOptions{
+ Flags: 0,
+ })
+ parsedMarkdown := markdown.ToHTML([]byte(input), markdownParser, renderer)
res := string(parsedMarkdown)
res = strings.TrimPrefix(res, "<p>")
res = strings.TrimSuffix(res, "</p>\n")