Update dependencies and build to go1.22 (#2113)

* Update dependencies and build to go1.22

* Fix api changes wrt to dependencies

* Update golangci config
This commit is contained in:
Wim
2024-05-23 23:44:31 +02:00
committed by GitHub
parent 56e7bd01ca
commit 2f33fe86f5
1556 changed files with 3279522 additions and 1924375 deletions

View File

@@ -9,11 +9,11 @@ It's very fast and supports common extensions.
Tutorial: https://blog.kowalczyk.info/article/cxn3/advanced-markdown-processing-in-go.html
Code examples:
* https://onlinetool.io/goplayground/#txO7hJ-ibeU : basic markdown => HTML
* https://onlinetool.io/goplayground/#yFRIWRiu-KL : customize HTML renderer
* https://onlinetool.io/goplayground/#2yV5-HDKBUV : modify AST
* https://onlinetool.io/goplayground/#9fqKwRbuJ04 : customize parser
* https://onlinetool.io/goplayground/#Bk0zTvrzUDR : syntax highlight
* https://tools.arslexis.io/goplayground/#txO7hJ-ibeU : basic markdown => HTML
* https://tools.arslexis.io/goplayground/#yFRIWRiu-KL : customize HTML renderer
* https://tools.arslexis.io/goplayground/#2yV5-HDKBUV : modify AST
* https://tools.arslexis.io/goplayground/#9fqKwRbuJ04 : customize parser
* https://tools.arslexis.io/goplayground/#Bk0zTvrzUDR : syntax highlight
Those examples are also in [examples](./examples) directory.
@@ -226,7 +226,7 @@ implements the following extensions:
- **Hard line breaks**. With this extension enabled newlines in the input
translates into line breaks in the output. This extension is off by default.
- **Non blocking space**. With this extension enabled spaces preceeded by a backslash
- **Non blocking space**. With this extension enabled spaces preceded by a backslash
in the input translates non-blocking spaces in the output. This extension is off by default.
- **Smart quotes**. Smartypants-style punctuation substitution is

View File

@@ -191,6 +191,11 @@ func (p *Parser) Block(data []byte) {
// <div>
// ...
// </div>
if len(data) == 0 {
continue
}
if data[0] == '<' {
if i := p.html(data, true); i > 0 {
data = data[i:]
@@ -393,7 +398,7 @@ func (p *Parser) AddBlock(n ast.Node) ast.Node {
}
func (p *Parser) isPrefixHeading(data []byte) bool {
if data[0] != '#' {
if len(data) > 0 && data[0] != '#' {
return false
}

View File

@@ -65,6 +65,11 @@ func citation(p *Parser, data []byte, offset int) (int, ast.Node) {
}
citeType := ast.CitationTypeInformative
if len(citation) < 2 {
continue
}
j = 1
switch citation[j] {
case '!':

View File

@@ -736,7 +736,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:]

View File

@@ -56,7 +56,7 @@ const (
)
// for each character that triggers a response when parsing inline data.
type inlineParser func(p *Parser, data []byte, offset int) (int, ast.Node)
type InlineParser func(p *Parser, data []byte, offset int) (int, ast.Node)
// ReferenceOverrideFunc is expected to be called with a reference string and
// return either a valid Reference type that the reference string maps to or
@@ -98,7 +98,7 @@ type Parser struct {
refs map[string]*reference
refsRecord map[string]struct{}
inlineCallback [256]inlineParser
inlineCallback [256]InlineParser
nesting int
maxNesting int
insideLink bool
@@ -181,6 +181,12 @@ func NewWithExtensions(extension Extensions) *Parser {
return &p
}
func (p *Parser) RegisterInline(n byte, fn InlineParser) InlineParser {
prev := p.inlineCallback[n]
p.inlineCallback[n] = fn
return prev
}
func (p *Parser) getRef(refid string) (ref *reference, found bool) {
if p.ReferenceOverride != nil {
r, overridden := p.ReferenceOverride(refid)
@@ -901,6 +907,9 @@ func isListItem(d ast.Node) bool {
}
func NormalizeNewlines(d []byte) []byte {
res := make([]byte, len(d))
copy(res, d)
d = res
wi := 0
n := len(d)
for i := 0; i < n; i++ {