diff --git a/.changes/unreleased/BUG FIXES-20240419-154226.yaml b/.changes/unreleased/BUG FIXES-20240419-154226.yaml new file mode 100644 index 00000000..454ac183 --- /dev/null +++ b/.changes/unreleased/BUG FIXES-20240419-154226.yaml @@ -0,0 +1,6 @@ +kind: BUG FIXES +body: 'generate: fixed a bug where the `plainmarkdown` function did not output plain + URLs' +time: 2024-04-19T15:42:26.250348-04:00 +custom: + Issue: "361" diff --git a/internal/mdplain/renderer.go b/internal/mdplain/renderer.go index 55965dc7..93bd5ec7 100644 --- a/internal/mdplain/renderer.go +++ b/internal/mdplain/renderer.go @@ -61,9 +61,12 @@ func (r *TextRender) Render(w io.Writer, source []byte, n ast.Node) error { return ast.WalkSkipChildren, nil } return ast.WalkContinue, nil - case *ast.AutoLink, *extAST.Strikethrough: + case *extAST.Strikethrough: out.Write(node.Text(source)) return ast.WalkContinue, nil + case *ast.AutoLink: + out.Write(node.URL(source)) + return ast.WalkSkipChildren, nil case *ast.CodeSpan: out.Write(node.Text(source)) return ast.WalkSkipChildren, nil diff --git a/internal/mdplain/testdata/markdown.md b/internal/mdplain/testdata/markdown.md index f5c1eccc..952e82ee 100644 --- a/internal/mdplain/testdata/markdown.md +++ b/internal/mdplain/testdata/markdown.md @@ -50,6 +50,7 @@ These are the elements outlined in John Gruber’s original design document. All [Relative Link](#Code) +Plain URL: https://www.markdownguide.org ### Image diff --git a/internal/mdplain/testdata/mdplain.txt b/internal/mdplain/testdata/mdplain.txt index c158f0c1..d7dcbee5 100644 --- a/internal/mdplain/testdata/mdplain.txt +++ b/internal/mdplain/testdata/mdplain.txt @@ -23,6 +23,7 @@ Horizontal Rule Link Markdown Guide https://www.markdownguide.org Relative Link +Plain URL: https://www.markdownguide.org Image Extended Syntax