make autolink peforms like GFM

This commit is contained in:
athom 2013-08-09 16:28:35 +08:00
parent 8751c35d1a
commit 16c09b01bd

View File

@ -620,7 +620,7 @@ func autoLink(p *parser, out *bytes.Buffer, data []byte, offset int) int {
// scan backward for a word boundary // scan backward for a word boundary
rewind := 0 rewind := 0
for offset-rewind > 0 && rewind <= 7 && !isspace(data[offset-rewind-1]) && !isspace(data[offset-rewind-1]) { for offset-rewind > 0 && rewind <= 7 && isalnum(data[offset-rewind-1]) {
rewind++ rewind++
} }
if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters