summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gomarkdown
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-06-11 23:07:42 +0200
committerGitHub <noreply@github.com>2022-06-11 23:07:42 +0200
commit8751fb4bb1eb7cd34ed63be9b3801b8aeac71a1d (patch)
tree601d2616b05b5b197bd2a3ae7cb245b1a0ea17e7 /vendor/github.com/gomarkdown
parent3819062574ac7e4af6a562bf40a425469a7752fb (diff)
downloadmatterbridge-msglm-8751fb4bb1eb7cd34ed63be9b3801b8aeac71a1d.tar.gz
matterbridge-msglm-8751fb4bb1eb7cd34ed63be9b3801b8aeac71a1d.tar.bz2
matterbridge-msglm-8751fb4bb1eb7cd34ed63be9b3801b8aeac71a1d.zip
Update dependencies (#1841)
Diffstat (limited to 'vendor/github.com/gomarkdown')
-rw-r--r--vendor/github.com/gomarkdown/markdown/fuzz.go1
-rw-r--r--vendor/github.com/gomarkdown/markdown/html/renderer.go90
-rw-r--r--vendor/github.com/gomarkdown/markdown/internal/valid/valid.go14
-rw-r--r--vendor/github.com/gomarkdown/markdown/parser/block.go4
-rw-r--r--vendor/github.com/gomarkdown/markdown/parser/inline.go10
-rw-r--r--vendor/github.com/gomarkdown/markdown/parser/parser.go3
6 files changed, 26 insertions, 96 deletions
diff --git a/vendor/github.com/gomarkdown/markdown/fuzz.go b/vendor/github.com/gomarkdown/markdown/fuzz.go
index 704182b8..f31adb8f 100644
--- a/vendor/github.com/gomarkdown/markdown/fuzz.go
+++ b/vendor/github.com/gomarkdown/markdown/fuzz.go
@@ -1,3 +1,4 @@
+//go:build gofuzz
// +build gofuzz
package markdown
diff --git a/vendor/github.com/gomarkdown/markdown/html/renderer.go b/vendor/github.com/gomarkdown/markdown/html/renderer.go
index 68868573..42b39f30 100644
--- a/vendor/github.com/gomarkdown/markdown/html/renderer.go
+++ b/vendor/github.com/gomarkdown/markdown/html/renderer.go
@@ -11,6 +11,7 @@ import (
"strings"
"github.com/gomarkdown/markdown/ast"
+ "github.com/gomarkdown/markdown/internal/valid"
"github.com/gomarkdown/markdown/parser"
)
@@ -211,70 +212,6 @@ func NewRenderer(opts RendererOptions) *Renderer {
}
}
-func isHTMLTag(tag []byte, tagname string) bool {
- found, _ := findHTMLTagPos(tag, tagname)
- return found
-}
-
-// Look for a character, but ignore it when it's in any kind of quotes, it
-// might be JavaScript
-func skipUntilCharIgnoreQuotes(html []byte, start int, char byte) int {
- inSingleQuote := false
- inDoubleQuote := false
- inGraveQuote := false
- i := start
- for i < len(html) {
- switch {
- case html[i] == char && !inSingleQuote && !inDoubleQuote && !inGraveQuote:
- return i
- case html[i] == '\'':
- inSingleQuote = !inSingleQuote
- case html[i] == '"':
- inDoubleQuote = !inDoubleQuote
- case html[i] == '`':
- inGraveQuote = !inGraveQuote
- }
- i++
- }
- return start
-}
-
-func findHTMLTagPos(tag []byte, tagname string) (bool, int) {
- i := 0
- if i < len(tag) && tag[0] != '<' {
- return false, -1
- }
- i++
- i = skipSpace(tag, i)
-
- if i < len(tag) && tag[i] == '/' {
- i++
- }
-
- i = skipSpace(tag, i)
- j := 0
- for ; i < len(tag); i, j = i+1, j+1 {
- if j >= len(tagname) {
- break
- }
-
- if strings.ToLower(string(tag[i]))[0] != tagname[j] {
- return false, -1
- }
- }
-
- if i == len(tag) {
- return false, -1
- }
-
- rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>')
- if rightAngle >= i {
- return true, rightAngle
- }
-
- return false, -1
-}
-
func isRelativeLink(link []byte) (yes bool) {
// a tag begin with '#'
if link[0] == '#' {
@@ -351,14 +288,6 @@ func needSkipLink(flags Flags, dest []byte) bool {
return flags&Safelink != 0 && !isSafeLink(dest) && !isMailto(dest)
}
-func isSmartypantable(node ast.Node) bool {
- switch node.GetParent().(type) {
- case *ast.Link, *ast.CodeBlock, *ast.Code:
- return false
- }
- return true
-}
-
func appendLanguageAttr(attrs []string, info []byte) []string {
if len(info) == 0 {
return attrs
@@ -1297,21 +1226,8 @@ func isListItemTerm(node ast.Node) bool {
return ok && data.ListFlags&ast.ListTypeTerm != 0
}
-// TODO: move to internal package
-func skipSpace(data []byte, i int) int {
- n := len(data)
- for i < n && isSpace(data[i]) {
- i++
- }
- return i
-}
-
-// TODO: move to internal package
-var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")}
-var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")}
-
func isSafeLink(link []byte) bool {
- for _, path := range validPaths {
+ for _, path := range valid.Paths {
if len(link) >= len(path) && bytes.Equal(link[:len(path)], path) {
if len(link) == len(path) {
return true
@@ -1321,7 +1237,7 @@ func isSafeLink(link []byte) bool {
}
}
- for _, prefix := range validUris {
+ for _, prefix := range valid.URIs {
// TODO: handle unicode here
// case-insensitive prefix test
if len(link) > len(prefix) && bytes.Equal(bytes.ToLower(link[:len(prefix)]), prefix) && isAlnum(link[len(prefix)]) {
diff --git a/vendor/github.com/gomarkdown/markdown/internal/valid/valid.go b/vendor/github.com/gomarkdown/markdown/internal/valid/valid.go
new file mode 100644
index 00000000..b9a761eb
--- /dev/null
+++ b/vendor/github.com/gomarkdown/markdown/internal/valid/valid.go
@@ -0,0 +1,14 @@
+package valid
+
+var URIs = [][]byte{
+ []byte("http://"),
+ []byte("https://"),
+ []byte("ftp://"),
+ []byte("mailto:"),
+}
+
+var Paths = [][]byte{
+ []byte("/"),
+ []byte("./"),
+ []byte("../"),
+}
diff --git a/vendor/github.com/gomarkdown/markdown/parser/block.go b/vendor/github.com/gomarkdown/markdown/parser/block.go
index dee173f8..eeebec73 100644
--- a/vendor/github.com/gomarkdown/markdown/parser/block.go
+++ b/vendor/github.com/gomarkdown/markdown/parser/block.go
@@ -24,8 +24,8 @@ const (
)
var (
- reBackslashOrAmp = regexp.MustCompile("[\\&]")
- reEntityOrEscapedChar = regexp.MustCompile("(?i)\\\\" + escapable + "|" + charEntity)
+ reBackslashOrAmp = regexp.MustCompile(`[\&]`)
+ reEntityOrEscapedChar = regexp.MustCompile(`(?i)\\` + escapable + "|" + charEntity)
// blockTags is a set of tags that are recognized as HTML block tags.
// Any of these can be included in markdown text without special escaping.
diff --git a/vendor/github.com/gomarkdown/markdown/parser/inline.go b/vendor/github.com/gomarkdown/markdown/parser/inline.go
index 1f23935c..ae7f244e 100644
--- a/vendor/github.com/gomarkdown/markdown/parser/inline.go
+++ b/vendor/github.com/gomarkdown/markdown/parser/inline.go
@@ -6,6 +6,7 @@ import (
"strconv"
"github.com/gomarkdown/markdown/ast"
+ "github.com/gomarkdown/markdown/internal/valid"
)
// Parsing of inline elements
@@ -994,12 +995,9 @@ func isEndOfLink(char byte) bool {
return isSpace(char) || char == '<'
}
-var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")}
-var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")}
-
func isSafeLink(link []byte) bool {
nLink := len(link)
- for _, path := range validPaths {
+ for _, path := range valid.Paths {
nPath := len(path)
linkPrefix := link[:nPath]
if nLink >= nPath && bytes.Equal(linkPrefix, path) {
@@ -1011,7 +1009,7 @@ func isSafeLink(link []byte) bool {
}
}
- for _, prefix := range validUris {
+ for _, prefix := range valid.URIs {
// TODO: handle unicode here
// case-insensitive prefix test
nPrefix := len(prefix)
@@ -1119,7 +1117,7 @@ func isMailtoAutoLink(data []byte) int {
nb++
case '-', '.', '_':
- break
+ // no-op but not defult
case '>':
if nb == 1 {
diff --git a/vendor/github.com/gomarkdown/markdown/parser/parser.go b/vendor/github.com/gomarkdown/markdown/parser/parser.go
index 7712a29f..eb63a911 100644
--- a/vendor/github.com/gomarkdown/markdown/parser/parser.go
+++ b/vendor/github.com/gomarkdown/markdown/parser/parser.go
@@ -8,7 +8,6 @@ import (
"fmt"
"strconv"
"strings"
- "unicode/utf8"
"github.com/gomarkdown/markdown/ast"
)
@@ -720,6 +719,7 @@ func isAlnum(c byte) bool {
// TODO: this is not used
// Replace tab characters with spaces, aligning to the next TAB_SIZE column.
// always ends output with a newline
+/*
func expandTabs(out *bytes.Buffer, line []byte, tabSize int) {
// first, check for common cases: no tabs, or only tabs at beginning of line
i, prefix := 0, 0
@@ -775,6 +775,7 @@ func expandTabs(out *bytes.Buffer, line []byte, tabSize int) {
i++
}
}
+*/
// Find if a line counts as indented or not.
// Returns number of characters the indent is (0 = not indented).