Skip to content

Commit

Permalink
Write the node URL for AutoLink nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
SBGoods committed Apr 19, 2024
1 parent c8e5e1f commit e22ef54
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/mdplain/renderer.go
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions internal/mdplain/testdata/markdown.md
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions internal/mdplain/testdata/mdplain.txt
Expand Up @@ -23,6 +23,7 @@ Horizontal Rule
Link
Markdown Guide https://www.markdownguide.org
Relative Link
Plain URL: https://www.markdownguide.org
Image

Extended Syntax
Expand Down

0 comments on commit e22ef54

Please sign in to comment.