From 585d1556c18abc8b259819847d05b2b088bee806 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 2 Feb 2020 18:35:43 +0100 Subject: Disable smartypants in markdown parser. Fixes #989, #983 (#993) --- bridge/helper/helper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bridge/helper') 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, "

") res = strings.TrimSuffix(res, "

\n") -- cgit v1.2.3