diff options
Diffstat (limited to 'bridge/helper/helper.go')
-rw-r--r-- | bridge/helper/helper.go | 6 |
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") |