From 9c44d6aa4740be3c9bdc8f1bfb59faa2d077e0b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 13:41:55 +0200 Subject: [PATCH] [chore]: Bump github.com/yuin/goldmark from 1.7.3 to 1.7.4 (#3059) Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.3 to 1.7.4. - [Release notes](https://github.com/yuin/goldmark/releases) - [Commits](https://github.com/yuin/goldmark/compare/v1.7.3...v1.7.4) --- updated-dependencies: - dependency-name: github.com/yuin/goldmark dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 +- vendor/github.com/yuin/goldmark/markdown.go | 3 +- .../github.com/yuin/goldmark/parser/link.go | 53 ++++++++++++++++--- .../yuin/goldmark/renderer/html/html.go | 2 +- vendor/modules.txt | 2 +- 6 files changed, 53 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index bee451ea2..fa6321107 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( github.com/uptrace/bun/dialect/sqlitedialect v1.2.1 github.com/uptrace/bun/extra/bunotel v1.2.1 github.com/wagslane/go-password-validator v0.3.0 - github.com/yuin/goldmark v1.7.3 + github.com/yuin/goldmark v1.7.4 go.opentelemetry.io/otel v1.26.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 diff --git a/go.sum b/go.sum index 75379c2b4..408dbc8a3 100644 --- a/go.sum +++ b/go.sum @@ -631,8 +631,8 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.7.3 h1:fdk0a/y60GsS4NbEd13GSIP+d8OjtTkmluY32Dy1Z/A= -github.com/yuin/goldmark v1.7.3/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= +github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround h1:gFAlklid3jyXIuZBy5Vy0dhG+F6YBgosRy4syT5CDsg= gitlab.com/NyaaaWhatsUpDoc/sqlite v1.29.9-concurrency-workaround/go.mod h1:ItX2a1OVGgNsFh6Dv60JQvGfJfTPHPVpV6DF59akYOA= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= diff --git a/vendor/github.com/yuin/goldmark/markdown.go b/vendor/github.com/yuin/goldmark/markdown.go index 86d12e225..8ebaa5a25 100644 --- a/vendor/github.com/yuin/goldmark/markdown.go +++ b/vendor/github.com/yuin/goldmark/markdown.go @@ -2,12 +2,13 @@ package goldmark import ( + "io" + "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" - "io" ) // DefaultParser returns a new Parser that is configured by default values. diff --git a/vendor/github.com/yuin/goldmark/parser/link.go b/vendor/github.com/yuin/goldmark/parser/link.go index 57840bdfb..7390d7beb 100644 --- a/vendor/github.com/yuin/goldmark/parser/link.go +++ b/vendor/github.com/yuin/goldmark/parser/link.go @@ -126,13 +126,13 @@ func (s *linkParser) Parse(parent ast.Node, block text.Reader, pc Context) ast.N if line[0] == '!' { if len(line) > 1 && line[1] == '[' { block.Advance(1) - pc.Set(linkBottom, pc.LastDelimiter()) + pushLinkBottom(pc) return processLinkLabelOpen(block, segment.Start+1, true, pc) } return nil } if line[0] == '[' { - pc.Set(linkBottom, pc.LastDelimiter()) + pushLinkBottom(pc) return processLinkLabelOpen(block, segment.Start, false, pc) } @@ -143,6 +143,7 @@ func (s *linkParser) Parse(parent ast.Node, block text.Reader, pc Context) ast.N } last := tlist.(*linkLabelState).Last if last == nil { + _ = popLinkBottom(pc) return nil } block.Advance(1) @@ -151,11 +152,13 @@ func (s *linkParser) Parse(parent ast.Node, block text.Reader, pc Context) ast.N // > A link label can have at most 999 characters inside the square brackets. if linkLabelStateLength(tlist.(*linkLabelState)) > 998 { ast.MergeOrReplaceTextSegment(last.Parent(), last, last.Segment) + _ = popLinkBottom(pc) return nil } if !last.IsImage && s.containsLink(last) { // a link in a link text is not allowed ast.MergeOrReplaceTextSegment(last.Parent(), last, last.Segment) + _ = popLinkBottom(pc) return nil } @@ -169,6 +172,7 @@ func (s *linkParser) Parse(parent ast.Node, block text.Reader, pc Context) ast.N link, hasValue = s.parseReferenceLink(parent, last, block, pc) if link == nil && hasValue { ast.MergeOrReplaceTextSegment(last.Parent(), last, last.Segment) + _ = popLinkBottom(pc) return nil } } @@ -182,12 +186,14 @@ func (s *linkParser) Parse(parent ast.Node, block text.Reader, pc Context) ast.N // > A link label can have at most 999 characters inside the square brackets. if len(maybeReference) > 999 { ast.MergeOrReplaceTextSegment(last.Parent(), last, last.Segment) + _ = popLinkBottom(pc) return nil } ref, ok := pc.Reference(util.ToLinkReference(maybeReference)) if !ok { ast.MergeOrReplaceTextSegment(last.Parent(), last, last.Segment) + _ = popLinkBottom(pc) return nil } link = ast.NewLink() @@ -230,11 +236,7 @@ func processLinkLabelOpen(block text.Reader, pos int, isImage bool, pc Context) } func (s *linkParser) processLinkLabel(parent ast.Node, link *ast.Link, last *linkLabelState, pc Context) { - var bottom ast.Node - if v := pc.Get(linkBottom); v != nil { - bottom = v.(ast.Node) - } - pc.Set(linkBottom, nil) + bottom := popLinkBottom(pc) ProcessDelimiters(bottom, pc) for c := last.NextSibling(); c != nil; { next := c.NextSibling() @@ -395,6 +397,43 @@ func parseLinkTitle(block text.Reader) ([]byte, bool) { return nil, false } +func pushLinkBottom(pc Context) { + bottoms := pc.Get(linkBottom) + b := pc.LastDelimiter() + if bottoms == nil { + pc.Set(linkBottom, b) + return + } + if s, ok := bottoms.([]ast.Node); ok { + pc.Set(linkBottom, append(s, b)) + return + } + pc.Set(linkBottom, []ast.Node{bottoms.(ast.Node), b}) +} + +func popLinkBottom(pc Context) ast.Node { + bottoms := pc.Get(linkBottom) + if bottoms == nil { + return nil + } + if v, ok := bottoms.(ast.Node); ok { + pc.Set(linkBottom, nil) + return v + } + s := bottoms.([]ast.Node) + v := s[len(s)-1] + n := s[0 : len(s)-1] + switch len(n) { + case 0: + pc.Set(linkBottom, nil) + case 1: + pc.Set(linkBottom, n[0]) + default: + pc.Set(linkBottom, s[0:len(s)-1]) + } + return v +} + func (s *linkParser) CloseBlock(parent ast.Node, block text.Reader, pc Context) { pc.Set(linkBottom, nil) tlist := pc.Get(linkLabelStateKey) diff --git a/vendor/github.com/yuin/goldmark/renderer/html/html.go b/vendor/github.com/yuin/goldmark/renderer/html/html.go index f9521d0fa..9ebd0a371 100644 --- a/vendor/github.com/yuin/goldmark/renderer/html/html.go +++ b/vendor/github.com/yuin/goldmark/renderer/html/html.go @@ -779,7 +779,7 @@ func (r *Renderer) renderAttribute(w util.BufWriter, source []byte, n ast.Node) } else if !c.HasChildren() { r.Writer.Write(w, c.Text(source)) if t, ok := c.(*ast.Text); ok && t.SoftLineBreak() { - w.WriteByte('\n') + _ = w.WriteByte('\n') } } else { r.renderAttribute(w, source, c) diff --git a/vendor/modules.txt b/vendor/modules.txt index 5650e8ba8..fd35fb956 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -938,7 +938,7 @@ github.com/vmihailenco/tagparser/v2/internal/parser # github.com/wagslane/go-password-validator v0.3.0 ## explicit; go 1.16 github.com/wagslane/go-password-validator -# github.com/yuin/goldmark v1.7.3 +# github.com/yuin/goldmark v1.7.4 ## explicit; go 1.19 github.com/yuin/goldmark github.com/yuin/goldmark/ast