diff --git a/go.mod b/go.mod index b9ccbf71..74db0a04 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/reconquest/regexputil-go v0.0.0-20160905154124-38573e70c1f4 github.com/stretchr/testify v1.9.0 github.com/urfave/cli/v2 v2.27.5 - github.com/yuin/goldmark v1.7.6 + github.com/yuin/goldmark v1.7.8 golang.org/x/tools v0.26.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index b2fcc390..fb65726c 100644 --- a/go.sum +++ b/go.sum @@ -59,8 +59,8 @@ github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= -github.com/yuin/goldmark v1.7.6 h1:cZgJxVh5mL5cu8KOnwxvFJy5TFB0BHUskZZyq7TYbDg= -github.com/yuin/goldmark v1.7.6/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= +github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/zazab/zhash v0.0.0-20221031090444-2b0d50417446 h1:75pcOSsb40+ub185cJI7g5uykl9Uu76rD5ONzK/4s40= github.com/zazab/zhash v0.0.0-20221031090444-2b0d50417446/go.mod h1:NtepZ8TEXErPsmQDMUoN72f8aIy4+xNinSJ3f1giess= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/renderer/blockquote.go b/renderer/blockquote.go index 30e8fd0d..9489cd5a 100644 --- a/renderer/blockquote.go +++ b/renderer/blockquote.go @@ -108,7 +108,7 @@ func ParseBlockQuoteType(node ast.Node, source []byte) BlockQuoteType { if countParagraphs < 2 && entering { if node.Kind() == ast.KindText { n := node.(*ast.Text) - t = legacyClassifier.ClassifyingBlockQuote(string(n.Text(source))) + t = legacyClassifier.ClassifyingBlockQuote(string(n.Value(source))) // If the node is a text node but classification returned none do not give up! // Find the next two sibling nodes midNode and rightNode, // 1. If both are also a text node @@ -124,8 +124,8 @@ func ParseBlockQuoteType(node ast.Node, source []byte) BlockQuoteType { midTextNode := midNode.(*ast.Text) if rightNode != nil && rightNode.Kind() == ast.KindText { rightTextNode := rightNode.(*ast.Text) - if string(n.Text(source)) == "[" && string(rightTextNode.Text(source)) == "]" { - t = ghAlertsClassifier.ClassifyingBlockQuote(string(midTextNode.Text(source))) + if string(n.Value(source)) == "[" && string(rightTextNode.Value(source)) == "]" { + t = ghAlertsClassifier.ClassifyingBlockQuote(string(midTextNode.Value(source))) } } } diff --git a/renderer/image.go b/renderer/image.go index c76d9fe0..f024016d 100644 --- a/renderer/image.go +++ b/renderer/image.go @@ -107,9 +107,9 @@ func nodeToHTMLText(n ast.Node, source []byte) []byte { var buf bytes.Buffer for c := n.FirstChild(); c != nil; c = c.NextSibling() { if s, ok := c.(*ast.String); ok && s.IsCode() { - buf.Write(s.Text(source)) - } else if !c.HasChildren() { - buf.Write(util.EscapeHTML(c.Text(source))) + buf.Write(s.Value) + } else if t, ok := c.(*ast.Text); ok { + buf.Write(util.EscapeHTML(t.Value(source))) } else { buf.Write(nodeToHTMLText(c, source)) } diff --git a/renderer/link.go b/renderer/link.go index 838ac598..7f269102 100644 --- a/renderer/link.go +++ b/renderer/link.go @@ -33,7 +33,8 @@ func (r *ConfluenceLinkRenderer) renderLink(writer util.BufWriter, source []byte return ast.WalkStop, err } - if len(n.Destination) < 4 { + if len(string(n.Destination)) < 4 { + //nolint:staticcheck _, err := writer.Write(node.Text(source)) if err != nil { return ast.WalkStop, err @@ -50,6 +51,7 @@ func (r *ConfluenceLinkRenderer) renderLink(writer util.BufWriter, source []byte return ast.WalkStop, err } + //nolint:staticcheck _, err = writer.Write(node.Text(source)) if err != nil { return ast.WalkStop, err diff --git a/renderer/text.go b/renderer/text.go index ef7865f0..d75e96ce 100644 --- a/renderer/text.go +++ b/renderer/text.go @@ -63,7 +63,7 @@ func (r *ConfluenceTextRenderer) renderText(w util.BufWriter, source []byte, nod if r.EastAsianLineBreaks != html.EastAsianLineBreaksNone && len(value) != 0 { sibling := node.NextSibling() if sibling != nil && sibling.Kind() == ast.KindText { - if siblingText := sibling.(*ast.Text).Text(source); len(siblingText) != 0 { + if siblingText := sibling.(*ast.Text).Value(source); len(siblingText) != 0 { thisLastRune := util.ToRune(value, len(value)-1) siblingFirstRune, _ := utf8.DecodeRune(siblingText) // Inline the softLineBreak function as it's not public