[chore]: Bump github.com/yuin/goldmark from 1.7.4 to 1.7.6 (#3430)
Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.4 to 1.7.6. - [Release notes](https://github.com/yuin/goldmark/releases) - [Commits](https://github.com/yuin/goldmark/compare/v1.7.4...v1.7.6) --- updated-dependencies: - dependency-name: github.com/yuin/goldmark dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
020da28daa
commit
be3b8076ca
2
go.mod
2
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.4
|
||||
github.com/yuin/goldmark v1.7.6
|
||||
go.opentelemetry.io/otel v1.29.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.29.0
|
||||
|
|
4
go.sum
4
go.sum
|
@ -621,8 +621,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.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg=
|
||||
github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
github.com/yuin/goldmark v1.7.6 h1:cZgJxVh5mL5cu8KOnwxvFJy5TFB0BHUskZZyq7TYbDg=
|
||||
github.com/yuin/goldmark v1.7.6/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.33.1-concurrency-workaround h1:pFMJnlc1PuH+jcVz4vz53vcpnoZG+NqFBr3qikDmEB4=
|
||||
gitlab.com/NyaaaWhatsUpDoc/sqlite v1.33.1-concurrency-workaround/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
|
||||
go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
|
@ -47,6 +48,15 @@ func (b *BaseBlock) SetLines(v *textm.Segments) {
|
|||
b.lines = v
|
||||
}
|
||||
|
||||
// Text implements Node.Text.
|
||||
func (b *BaseBlock) Text(source []byte) []byte {
|
||||
var buf bytes.Buffer
|
||||
for _, line := range b.Lines().Sliced(0, b.Lines().Len()) {
|
||||
buf.Write(line.Value(source))
|
||||
}
|
||||
return buf.Bytes()
|
||||
}
|
||||
|
||||
// A Document struct is a root node of Markdown text.
|
||||
type Document struct {
|
||||
BaseBlock
|
||||
|
|
|
@ -184,11 +184,11 @@ func (b *tableParagraphTransformer) Transform(node *gast.Paragraph, reader text.
|
|||
func (b *tableParagraphTransformer) parseRow(segment text.Segment,
|
||||
alignments []ast.Alignment, isHeader bool, reader text.Reader, pc parser.Context) *ast.TableRow {
|
||||
source := reader.Source()
|
||||
segment = segment.TrimLeftSpace(source)
|
||||
segment = segment.TrimRightSpace(source)
|
||||
line := segment.Value(source)
|
||||
pos := 0
|
||||
pos += util.TrimLeftSpaceLength(line)
|
||||
limit := len(line)
|
||||
limit -= util.TrimRightSpaceLength(line)
|
||||
row := ast.NewTableRow(alignments)
|
||||
if len(line) > 0 && line[pos] == '|' {
|
||||
pos++
|
||||
|
|
|
@ -28,12 +28,13 @@ func (b *blockquoteParser) process(reader text.Reader) bool {
|
|||
reader.Advance(pos)
|
||||
return true
|
||||
}
|
||||
if line[pos] == ' ' || line[pos] == '\t' {
|
||||
pos++
|
||||
}
|
||||
reader.Advance(pos)
|
||||
if line[pos-1] == '\t' {
|
||||
reader.SetPadding(2)
|
||||
if line[pos] == ' ' || line[pos] == '\t' {
|
||||
padding := 0
|
||||
if line[pos] == '\t' {
|
||||
padding = util.TabWidth(reader.LineOffset()) - 1
|
||||
}
|
||||
reader.AdvanceAndSetPadding(1, padding)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ func (b *listItemParser) Continue(node ast.Node, reader text.Reader, pc Context)
|
|||
}
|
||||
|
||||
offset := lastOffset(node.Parent())
|
||||
isEmpty := node.ChildCount() == 0
|
||||
isEmpty := node.ChildCount() == 0 && pc.Get(emptyListItemWithBlankLines) != nil
|
||||
indent, _ := util.IndentWidth(line, reader.LineOffset())
|
||||
if (isEmpty || indent < offset) && indent < 4 {
|
||||
_, typ := matchesListItem(line, true)
|
||||
|
|
|
@ -878,10 +878,17 @@ func (p *parser) Parse(reader text.Reader, opts ...ParseOption) ast.Node {
|
|||
blockReader := text.NewBlockReader(reader.Source(), nil)
|
||||
p.walkBlock(root, func(node ast.Node) {
|
||||
p.parseBlock(blockReader, node, pc)
|
||||
lines := node.Lines()
|
||||
if lines != nil && lines.Len() != 0 {
|
||||
s := lines.At(lines.Len() - 1)
|
||||
s.EOB = true
|
||||
lines.Set(lines.Len()-1, s)
|
||||
}
|
||||
})
|
||||
for _, at := range p.astTransformers {
|
||||
at.Transform(root, reader, pc)
|
||||
}
|
||||
|
||||
// root.Dump(reader.Source(), 0)
|
||||
return root
|
||||
}
|
||||
|
@ -1256,4 +1263,5 @@ func (p *parser) parseBlock(block text.BlockReader, parent ast.Node, pc Context)
|
|||
for _, ip := range p.closeBlockers {
|
||||
ip.CloseBlock(parent, block, pc)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package text
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/yuin/goldmark/util"
|
||||
)
|
||||
|
||||
|
@ -18,6 +19,9 @@ type Segment struct {
|
|||
|
||||
// Padding is a padding length of the segment.
|
||||
Padding int
|
||||
|
||||
// EOB is true if the segment is end of the block.
|
||||
EOB bool
|
||||
}
|
||||
|
||||
// NewSegment return a new Segment.
|
||||
|
@ -40,12 +44,18 @@ func NewSegmentPadding(start, stop, n int) Segment {
|
|||
|
||||
// Value returns a value of the segment.
|
||||
func (t *Segment) Value(buffer []byte) []byte {
|
||||
var result []byte
|
||||
if t.Padding == 0 {
|
||||
return buffer[t.Start:t.Stop]
|
||||
}
|
||||
result := make([]byte, 0, t.Padding+t.Stop-t.Start+1)
|
||||
result = buffer[t.Start:t.Stop]
|
||||
} else {
|
||||
result = make([]byte, 0, t.Padding+t.Stop-t.Start+1)
|
||||
result = append(result, bytes.Repeat(space, t.Padding)...)
|
||||
return append(result, buffer[t.Start:t.Stop]...)
|
||||
result = append(result, buffer[t.Start:t.Stop]...)
|
||||
}
|
||||
if t.EOB && len(result) > 0 && result[len(result)-1] != '\n' {
|
||||
result = append(result, '\n')
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Len returns a length of the segment.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
//nolint:golint,lll,misspell
|
||||
package util
|
||||
|
||||
import "sync"
|
||||
|
||||
// An HTML5Entity struct represents HTML5 entitites.
|
||||
type HTML5Entity struct {
|
||||
Name string
|
||||
|
@ -11,11 +13,18 @@ type HTML5Entity struct {
|
|||
// LookUpHTML5EntityByName returns (an HTML5Entity, true) if an entity named
|
||||
// given name is found, otherwise (nil, false).
|
||||
func LookUpHTML5EntityByName(name string) (*HTML5Entity, bool) {
|
||||
v, ok := html5entities[name]
|
||||
v, ok := html5entities()[name]
|
||||
return v, ok
|
||||
}
|
||||
|
||||
var html5entities = map[string]*HTML5Entity{
|
||||
var html5entitiesOnce sync.Once // TODO: uses sync.OnceValue for future
|
||||
|
||||
var _html5entities map[string]*HTML5Entity
|
||||
|
||||
func html5entities() map[string]*HTML5Entity {
|
||||
html5entitiesOnce.Do(func() {
|
||||
_html5entities =
|
||||
map[string]*HTML5Entity{
|
||||
"AElig": {Name: "AElig", CodePoints: []int{198}, Characters: []byte{0xc3, 0x86}},
|
||||
"AMP": {Name: "AMP", CodePoints: []int{38}, Characters: []byte{0x26}},
|
||||
"Aacute": {Name: "Aacute", CodePoints: []int{193}, Characters: []byte{0xc3, 0x81}},
|
||||
|
@ -2141,3 +2150,6 @@ var html5entities = map[string]*HTML5Entity{
|
|||
"zwj": {Name: "zwj", CodePoints: []int{8205}, Characters: []byte{0xe2, 0x80, 0x8d}},
|
||||
"zwnj": {Name: "zwnj", CodePoints: []int{8204}, Characters: []byte{0xe2, 0x80, 0x8c}},
|
||||
}
|
||||
})
|
||||
return _html5entities
|
||||
}
|
||||
|
|
|
@ -166,7 +166,13 @@ func IndentPositionPadding(bs []byte, currentPos, paddingv, width int) (pos, pad
|
|||
w := 0
|
||||
i := 0
|
||||
l := len(bs)
|
||||
p := paddingv
|
||||
for ; i < l; i++ {
|
||||
if p > 0 {
|
||||
p--
|
||||
w++
|
||||
continue
|
||||
}
|
||||
if bs[i] == '\t' && w < width {
|
||||
w += TabWidth(currentPos + w)
|
||||
} else if bs[i] == ' ' && w < width {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//go:build !appengine && !js
|
||||
// +build !appengine,!js
|
||||
//go:build !appengine && !js && !go1.21
|
||||
// +build !appengine,!js,!go1.21
|
||||
|
||||
package util
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//go:build !appengine && !js && go1.21
|
||||
// +build !appengine,!js,go1.21
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// BytesToReadOnlyString returns a string converted from given bytes.
|
||||
func BytesToReadOnlyString(b []byte) string {
|
||||
return unsafe.String(unsafe.SliceData(b), len(b))
|
||||
}
|
||||
|
||||
// StringToReadOnlyBytes returns bytes converted from given string.
|
||||
func StringToReadOnlyBytes(s string) []byte {
|
||||
return unsafe.Slice(unsafe.StringData(s), len(s))
|
||||
}
|
|
@ -954,7 +954,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.4
|
||||
# github.com/yuin/goldmark v1.7.6
|
||||
## explicit; go 1.19
|
||||
github.com/yuin/goldmark
|
||||
github.com/yuin/goldmark/ast
|
||||
|
|
Loading…
Reference in New Issue