automatic links within backticks not escaped properly

John Gruber gruber at fedora.net
Tue Nov 30 01:20:39 EST 2004


david scotson <david.scotson at gmail.com> wrote on 11/28/04 at 6:21pm:

> The backtick method of escaping code gives an odd result when you try
> to escape a link surrounded with angle brackets (referred to in the
> documentation as "automatic links").

This is now fixed in 1.0.1b5. Thanks for the report.


> Note that I use PHP Markdown mostly but I see this behaviour with
> both Dinguses.

Yup, my bug, ported to PHP.


> Also, why is the angle bracket syntax used here when it would appear
> more consistent to use square brackets? In the other link styles the
> text to be linked is placed between square brackets. In this case the
> text to be linked just happens to be the same as the link destination.

The reason for this is that in plaintext documents, URLs have
historically/traditionally been marked with < and >. For example,
from section 2.2 of [RFC 1738] [1], by Tim Berners-Lee:

   Unsafe:

   Characters can be unsafe for a number of reasons.  The space
   character is unsafe because significant spaces may disappear and
   insignificant spaces may be introduced when URLs are transcribed or
   typeset or subjected to the treatment of word-processing programs.
   The characters "<" and ">" are unsafe because they are used as the
   delimiters around URLs in free text; the quote mark (""") is used to
   delimit URLs in some systems.


[1]: http://www.ietf.org/rfc/rfc1738.txt


> Another factor is that having something that looks a bit like an HTML
> tag (i.e. some text surrounded by angle brackets) seems to be asking
> for trouble in a system that allows HTML too.

I don't think so. Markdown's auto-link syntax only allows for links
that start with proper protocols ('http:', 'ftp:', etc.) or which
contain an email address. It's relatively easy to tell one apart
from an HTML tag.

Regards,

-J.G.


More information about the Markdown-discuss mailing list