Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 6457c8c55f937118e4e673fee899d24cf93d3006 Author: Wim <wim@42.be> Date: Sun Feb 02 18:35:43 2020 +0000 Disable smartypants in markdown parser. Fixes #989, #983 (#993) diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go index 66ba64c..8d75a8a 100644 --- a/bridge/helper/helper.go +++ b/bridge/helper/helper.go @@ -156 +157 @@ 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"  ) @@ -1817 +18210 @@ 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") diff --git a/go.mod b/go.mod index d47fa93..6f6cddc 100644 --- a/go.mod +++ b/go.mod @@ -117 +117 @@ require (   github.com/dfordsoft/golib v0.0.0-20180902042739-76ee6ab99bec   github.com/fsnotify/fsnotify v1.4.7   github.com/go-telegram-bot-api/telegram-bot-api v4.6.5-0.20181225215658-ec221ba9ea45+incompatible - github.com/gomarkdown/markdown v0.0.0-20200105192015-0948ad373b2c + github.com/gomarkdown/markdown v0.0.0-20200127000047-1813ea067497   github.com/google/gops v0.3.6   github.com/gopackage/ddp v0.0.0-20170117053602-652027933df4 // indirect   github.com/gorilla/schema v1.1.0 diff --git a/go.sum b/go.sum index c356ee3..8d15de1 100644 --- a/go.sum +++ b/go.sum @@ -648 +648 @@ github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk  github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=  github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=  github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gomarkdown/markdown v0.0.0-20200105192015-0948ad373b2c h1:YQi5cVUn3bbQSS7fadb1G9LLp+sqYk5bQEw+VYes7MQ= -github.com/gomarkdown/markdown v0.0.0-20200105192015-0948ad373b2c/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= +github.com/gomarkdown/markdown v0.0.0-20200127000047-1813ea067497 h1:wJkj+x9gPYlDyM34C6r3SXPs270coWeh85wu1CsusDo= +github.com/gomarkdown/markdown v0.0.0-20200127000047-1813ea067497/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU=  github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=  github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=  github.com/google/gops v0.3.6 h1:6akvbMlpZrEYOuoebn2kR+ZJekbZqJ28fJXTs84+8to=