mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-15 08:29:25 +01:00
parent
7486555875
commit
585d1556c1
@ -15,6 +15,7 @@ import (
|
|||||||
|
|
||||||
"github.com/42wim/matterbridge/bridge/config"
|
"github.com/42wim/matterbridge/bridge/config"
|
||||||
"github.com/gomarkdown/markdown"
|
"github.com/gomarkdown/markdown"
|
||||||
|
"github.com/gomarkdown/markdown/html"
|
||||||
"github.com/gomarkdown/markdown/parser"
|
"github.com/gomarkdown/markdown/parser"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@ -181,7 +182,10 @@ func ClipMessage(text string, length int) string {
|
|||||||
func ParseMarkdown(input string) string {
|
func ParseMarkdown(input string) string {
|
||||||
extensions := parser.HardLineBreak
|
extensions := parser.HardLineBreak
|
||||||
markdownParser := parser.NewWithExtensions(extensions)
|
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 := string(parsedMarkdown)
|
||||||
res = strings.TrimPrefix(res, "<p>")
|
res = strings.TrimPrefix(res, "<p>")
|
||||||
res = strings.TrimSuffix(res, "</p>\n")
|
res = strings.TrimSuffix(res, "</p>\n")
|
||||||
|
2
go.mod
2
go.mod
@ -11,7 +11,7 @@ require (
|
|||||||
github.com/dfordsoft/golib v0.0.0-20180902042739-76ee6ab99bec
|
github.com/dfordsoft/golib v0.0.0-20180902042739-76ee6ab99bec
|
||||||
github.com/fsnotify/fsnotify v1.4.7
|
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/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/google/gops v0.3.6
|
||||||
github.com/gopackage/ddp v0.0.0-20170117053602-652027933df4 // indirect
|
github.com/gopackage/ddp v0.0.0-20170117053602-652027933df4 // indirect
|
||||||
github.com/gorilla/schema v1.1.0
|
github.com/gorilla/schema v1.1.0
|
||||||
|
4
go.sum
4
go.sum
@ -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.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 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
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-20200127000047-1813ea067497 h1:wJkj+x9gPYlDyM34C6r3SXPs270coWeh85wu1CsusDo=
|
||||||
github.com/gomarkdown/markdown v0.0.0-20200105192015-0948ad373b2c/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU=
|
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/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
github.com/google/gops v0.3.6 h1:6akvbMlpZrEYOuoebn2kR+ZJekbZqJ28fJXTs84+8to=
|
github.com/google/gops v0.3.6 h1:6akvbMlpZrEYOuoebn2kR+ZJekbZqJ28fJXTs84+8to=
|
||||||
|
2
vendor/github.com/gomarkdown/markdown/html/doc.go
generated
vendored
2
vendor/github.com/gomarkdown/markdown/html/doc.go
generated
vendored
@ -8,7 +8,7 @@ A renderer can be configured with multiple options:
|
|||||||
import "github.com/gomarkdown/markdown/html"
|
import "github.com/gomarkdown/markdown/html"
|
||||||
|
|
||||||
flags := html.CommonFlags | html.CompletePage | html.HrefTargetBlank
|
flags := html.CommonFlags | html.CompletePage | html.HrefTargetBlank
|
||||||
opts := html.RenderOptions{
|
opts := html.RendererOptions{
|
||||||
TItle: "A custom title",
|
TItle: "A custom title",
|
||||||
Flags: flags,
|
Flags: flags,
|
||||||
}
|
}
|
||||||
|
2
vendor/github.com/gomarkdown/markdown/parser/inline.go
generated
vendored
2
vendor/github.com/gomarkdown/markdown/parser/inline.go
generated
vendored
@ -689,7 +689,7 @@ func leftAngle(p *Parser, data []byte, offset int) (int, ast.Node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// '\\' backslash escape
|
// '\\' backslash escape
|
||||||
var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~")
|
var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~^")
|
||||||
|
|
||||||
func escape(p *Parser, data []byte, offset int) (int, ast.Node) {
|
func escape(p *Parser, data []byte, offset int) (int, ast.Node) {
|
||||||
data = data[offset:]
|
data = data[offset:]
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -44,7 +44,7 @@ github.com/go-telegram-bot-api/telegram-bot-api
|
|||||||
# github.com/golang/protobuf v1.3.1
|
# github.com/golang/protobuf v1.3.1
|
||||||
github.com/golang/protobuf/proto
|
github.com/golang/protobuf/proto
|
||||||
github.com/golang/protobuf/protoc-gen-go/descriptor
|
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
|
||||||
github.com/gomarkdown/markdown/ast
|
github.com/gomarkdown/markdown/ast
|
||||||
github.com/gomarkdown/markdown/html
|
github.com/gomarkdown/markdown/html
|
||||||
|
Loading…
Reference in New Issue
Block a user