Skip to content

Commit 31cddc7

Browse files
authored
Revert "Bump github.com/yuin/goldmark from 1.7.7 to 1.7.12 (#484)" (#498)
This reverts commit 8b2645d.
1 parent 9ff8b91 commit 31cddc7

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
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.12
16+
github.com/yuin/goldmark v1.7.7
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.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY=
132-
github.com/yuin/goldmark v1.7.12/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
131+
github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU=
132+
github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
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: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,51 +26,59 @@ 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.CodeSpan:
30-
return ast.WalkContinue, nil
31-
case *ast.Heading, *ast.CodeBlock, *ast.List:
29+
case *ast.Blockquote, *ast.Heading:
3230
doubleSpace(out)
33-
return ast.WalkContinue, nil
31+
out.Write(node.Text(source))
32+
return ast.WalkSkipChildren, nil
3433
case *ast.ThematicBreak:
3534
doubleSpace(out)
3635
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
3743
case *ast.FencedCodeBlock:
3844
doubleSpace(out)
3945
doubleSpace(out)
40-
out.Write(node.Lines().Value(source))
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)
4153
return ast.WalkContinue, nil
4254
case *ast.Paragraph:
4355
doubleSpace(out)
44-
if node.Lines().Value(source)[0] == '|' { // Write tables as-is.
45-
out.Write(node.Lines().Value(source))
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+
}
4661
return ast.WalkSkipChildren, nil
4762
}
4863
return ast.WalkContinue, nil
4964
case *extAST.Strikethrough:
50-
out.Write(node.Lines().Value(source))
65+
out.Write(node.Text(source))
5166
return ast.WalkContinue, nil
5267
case *ast.AutoLink:
5368
out.Write(node.URL(source))
5469
return ast.WalkSkipChildren, nil
70+
case *ast.CodeSpan:
71+
out.Write(node.Text(source))
72+
return ast.WalkSkipChildren, nil
5573
case *ast.Link:
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-
74+
_, err := out.Write(node.Text(source))
6675
if !isRelativeLink(node.Destination) {
6776
out.WriteString(" ")
6877
out.Write(node.Destination)
6978
}
70-
71-
return ast.WalkSkipChildren, nil
79+
return ast.WalkSkipChildren, err
7280
case *ast.Text:
73-
out.Write(node.Value(source))
81+
out.Write(node.Text(source))
7482
if node.SoftLineBreak() {
7583
doubleSpace(out)
7684
}

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

0 commit comments

Comments
 (0)