Skip to content

Commit 8b2645d

Browse files
Bump github.com/yuin/goldmark from 1.7.7 to 1.7.12 (#484)
* Bump github.com/yuin/goldmark from 1.7.7 to 1.7.12 Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.7 to 1.7.12. - [Release notes](https://github.com/yuin/goldmark/releases) - [Commits](yuin/goldmark@v1.7.7...v1.7.12) --- updated-dependencies: - dependency-name: github.com/yuin/goldmark dependency-version: 1.7.12 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Remove deprecated `node.Text` references --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Selena Goods <[email protected]>
1 parent 2f25d2c commit 8b2645d

File tree

4 files changed

+25
-33
lines changed

4 files changed

+25
-33
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/hashicorp/terraform-json v0.25.0
1414
github.com/mattn/go-colorable v0.1.14
1515
github.com/rogpeppe/go-internal v1.14.1
16-
github.com/yuin/goldmark v1.7.7
16+
github.com/yuin/goldmark v1.7.12
1717
github.com/yuin/goldmark-meta v1.1.0
1818
github.com/zclconf/go-cty v1.16.3
1919
go.abhg.dev/goldmark/frontmatter v0.2.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
128128
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
129129
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
130130
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
131-
github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU=
132-
github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
131+
github.com/yuin/goldmark v1.7.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY=
132+
github.com/yuin/goldmark v1.7.12/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
133133
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=
134134
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
135135
github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk=

internal/mdplain/renderer.go

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,59 +26,51 @@ func (r *TextRender) Render(w io.Writer, source []byte, n ast.Node) error {
2626
}
2727

2828
switch node := node.(type) {
29-
case *ast.Blockquote, *ast.Heading:
29+
case *ast.Blockquote, *ast.CodeSpan:
30+
return ast.WalkContinue, nil
31+
case *ast.Heading, *ast.CodeBlock, *ast.List:
3032
doubleSpace(out)
31-
out.Write(node.Text(source))
32-
return ast.WalkSkipChildren, nil
33+
return ast.WalkContinue, nil
3334
case *ast.ThematicBreak:
3435
doubleSpace(out)
3536
return ast.WalkSkipChildren, nil
36-
case *ast.CodeBlock:
37-
doubleSpace(out)
38-
for i := 0; i < node.Lines().Len(); i++ {
39-
line := node.Lines().At(i)
40-
out.Write(line.Value(source))
41-
}
42-
return ast.WalkSkipChildren, nil
4337
case *ast.FencedCodeBlock:
4438
doubleSpace(out)
4539
doubleSpace(out)
46-
for i := 0; i < node.Lines().Len(); i++ {
47-
line := node.Lines().At(i)
48-
_, _ = out.Write(line.Value(source))
49-
}
50-
return ast.WalkSkipChildren, nil
51-
case *ast.List:
52-
doubleSpace(out)
40+
out.Write(node.Lines().Value(source))
5341
return ast.WalkContinue, nil
5442
case *ast.Paragraph:
5543
doubleSpace(out)
56-
if node.Text(source)[0] == '|' { // Write tables as-is.
57-
for i := 0; i < node.Lines().Len(); i++ {
58-
line := node.Lines().At(i)
59-
out.Write(line.Value(source))
60-
}
44+
if node.Lines().Value(source)[0] == '|' { // Write tables as-is.
45+
out.Write(node.Lines().Value(source))
6146
return ast.WalkSkipChildren, nil
6247
}
6348
return ast.WalkContinue, nil
6449
case *extAST.Strikethrough:
65-
out.Write(node.Text(source))
50+
out.Write(node.Lines().Value(source))
6651
return ast.WalkContinue, nil
6752
case *ast.AutoLink:
6853
out.Write(node.URL(source))
6954
return ast.WalkSkipChildren, nil
70-
case *ast.CodeSpan:
71-
out.Write(node.Text(source))
72-
return ast.WalkSkipChildren, nil
7355
case *ast.Link:
74-
_, err := out.Write(node.Text(source))
56+
// we want to write the text of the
57+
// link before the url
58+
child := node.FirstChild()
59+
if child != nil {
60+
t, ok := child.(*ast.Text)
61+
if ok {
62+
out.Write(t.Value(source))
63+
}
64+
}
65+
7566
if !isRelativeLink(node.Destination) {
7667
out.WriteString(" ")
7768
out.Write(node.Destination)
7869
}
79-
return ast.WalkSkipChildren, err
70+
71+
return ast.WalkSkipChildren, nil
8072
case *ast.Text:
81-
out.Write(node.Text(source))
73+
out.Write(node.Value(source))
8274
if node.SoftLineBreak() {
8375
doubleSpace(out)
8476
}

internal/provider/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func (m *migrator) ExtractCodeExamples(content []byte, newRelDir string, templat
296296
if fencedNode, isFenced := node.(*ast.FencedCodeBlock); isFenced && fencedNode.Info != nil {
297297
var ext, exampleName, examplePath, template string
298298

299-
lang := string(fencedNode.Info.Text(content)[:])
299+
lang := string(fencedNode.Info.Value(content)[:])
300300
switch lang {
301301
case "hcl", "terraform":
302302
exampleCount++

0 commit comments

Comments
 (0)