Fix incorrect autolinking when urls end at HTML tags.

Fixes #3879