summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gomarkdown/markdown/parser
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-11-22 15:55:57 +0100
committerGitHub <noreply@github.com>2020-11-22 15:55:57 +0100
commit4cc2c914e634eb8c79eb61aa1bc29faf6021ffcf (patch)
tree92d3b8d27cd35455eae7423e4d47aad67cc6a43b /vendor/github.com/gomarkdown/markdown/parser
parentcbb46293ab670c1989bfcd9aae5d853223074038 (diff)
downloadmatterbridge-msglm-4cc2c914e634eb8c79eb61aa1bc29faf6021ffcf.tar.gz
matterbridge-msglm-4cc2c914e634eb8c79eb61aa1bc29faf6021ffcf.tar.bz2
matterbridge-msglm-4cc2c914e634eb8c79eb61aa1bc29faf6021ffcf.zip
Update vendor (#1297)
Diffstat (limited to 'vendor/github.com/gomarkdown/markdown/parser')
-rw-r--r--vendor/github.com/gomarkdown/markdown/parser/block.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/vendor/github.com/gomarkdown/markdown/parser/block.go b/vendor/github.com/gomarkdown/markdown/parser/block.go
index a0b80991..5ef55e98 100644
--- a/vendor/github.com/gomarkdown/markdown/parser/block.go
+++ b/vendor/github.com/gomarkdown/markdown/parser/block.go
@@ -1074,10 +1074,14 @@ func isBackslashEscaped(data []byte, i int) bool {
func (p *Parser) tableHeader(data []byte) (size int, columns []ast.CellAlignFlags, table ast.Node) {
i := 0
colCount := 1
+ headerIsUnderline := true
for i = 0; i < len(data) && data[i] != '\n'; i++ {
if data[i] == '|' && !isBackslashEscaped(data, i) {
colCount++
}
+ if data[i] != '-' && data[i] != ' ' && data[i] != ':' && data[i] != '|' {
+ headerIsUnderline = false
+ }
}
// doesn't look like a table header
@@ -1097,10 +1101,18 @@ func (p *Parser) tableHeader(data []byte) (size int, columns []ast.CellAlignFlag
colCount--
}
+ // if the header looks like a underline, then we omit the header
+ // and parse the first line again as underline
+ if headerIsUnderline {
+ header = nil
+ i = 0
+ } else {
+ i++ // move past newline
+ }
+
columns = make([]ast.CellAlignFlags, colCount)
// move on to the header underline
- i++
if i >= len(data) {
return
}
@@ -1175,8 +1187,10 @@ func (p *Parser) tableHeader(data []byte) (size int, columns []ast.CellAlignFlag
table = &ast.Table{}
p.addBlock(table)
- p.addBlock(&ast.TableHeader{})
- p.tableRow(header, columns, true)
+ if header != nil {
+ p.addBlock(&ast.TableHeader{})
+ p.tableRow(header, columns, true)
+ }
size = skipCharN(data, i, '\n', 1)
return
}