Skip to content

Commit

Permalink
markdown: change isNumber to report negatively on empty input (#46)
Browse files Browse the repository at this point in the history
This change fixes an edge case where an escaped period after a link
did not get get unescaped. Escaping the period in that context is not
necessary, so it's helpful to unescape it and produce cleaner output.
  • Loading branch information
tianon authored and dmitshur committed Mar 11, 2019
1 parent 0ad3159 commit b3016f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion markdown/main.go
Expand Up @@ -346,7 +346,7 @@ func isNumber(data []byte) bool {
return false
}
}
return true
return len(data) > 0
}

func needsEscaping(text []byte, lastNormalText string) bool {
Expand Down
3 changes: 3 additions & 0 deletions markdown/testdata/url.golden.md
@@ -0,0 +1,3 @@
Lorem [ipsum](https://www.example.com).

Lorem [ipsum](https://www.example.com).
3 changes: 3 additions & 0 deletions markdown/testdata/url.in.md
@@ -0,0 +1,3 @@
Lorem [ipsum](https://www.example.com).

Lorem [ipsum](https://www.example.com)\.

0 comments on commit b3016f8

Please sign in to comment.