diff options
author | Wim <wim@42.be> | 2020-02-02 18:35:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-02 18:35:43 +0100 |
commit | 585d1556c18abc8b259819847d05b2b088bee806 (patch) | |
tree | 73d6d1cfc888e07149ea71da0e30e378081c680f | |
parent | 748655587527875ea360822255a60a892b8c4953 (diff) | |
download | matterbridge-msglm-585d1556c18abc8b259819847d05b2b088bee806.tar.gz matterbridge-msglm-585d1556c18abc8b259819847d05b2b088bee806.tar.bz2 matterbridge-msglm-585d1556c18abc8b259819847d05b2b088bee806.zip |
Disable smartypants in markdown parser. Fixes #989, #983 (#993)
-rw-r--r-- | bridge/helper/helper.go | 6 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | vendor/github.com/gomarkdown/markdown/html/doc.go | 2 | ||||
-rw-r--r-- | vendor/github.com/gomarkdown/markdown/parser/inline.go | 2 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
6 files changed, 11 insertions, 7 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") @@ -11,7 +11,7 @@ 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 @@ -64,8 +64,8 @@ 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= diff --git a/vendor/github.com/gomarkdown/markdown/html/doc.go b/vendor/github.com/gomarkdown/markdown/html/doc.go index f837c63d..b8d498d6 100644 --- a/vendor/github.com/gomarkdown/markdown/html/doc.go +++ b/vendor/github.com/gomarkdown/markdown/html/doc.go @@ -8,7 +8,7 @@ A renderer can be configured with multiple options: import "github.com/gomarkdown/markdown/html" flags := html.CommonFlags | html.CompletePage | html.HrefTargetBlank - opts := html.RenderOptions{ + opts := html.RendererOptions{ TItle: "A custom title", Flags: flags, } diff --git a/vendor/github.com/gomarkdown/markdown/parser/inline.go b/vendor/github.com/gomarkdown/markdown/parser/inline.go index 23849f3a..2a8ac77c 100644 --- a/vendor/github.com/gomarkdown/markdown/parser/inline.go +++ b/vendor/github.com/gomarkdown/markdown/parser/inline.go @@ -689,7 +689,7 @@ func leftAngle(p *Parser, data []byte, offset int) (int, ast.Node) { } // '\\' backslash escape -var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~") +var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~^") func escape(p *Parser, data []byte, offset int) (int, ast.Node) { data = data[offset:] diff --git a/vendor/modules.txt b/vendor/modules.txt index 32b59b59..0fba40d5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -44,7 +44,7 @@ github.com/go-telegram-bot-api/telegram-bot-api # github.com/golang/protobuf v1.3.1 github.com/golang/protobuf/proto github.com/golang/protobuf/protoc-gen-go/descriptor -# github.com/gomarkdown/markdown v0.0.0-20200105192015-0948ad373b2c +# github.com/gomarkdown/markdown v0.0.0-20200127000047-1813ea067497 github.com/gomarkdown/markdown github.com/gomarkdown/markdown/ast github.com/gomarkdown/markdown/html |