Autolinking is not Automatic


#1

Currently in this spec autolinking is not automatic, autolinks must be inside <>. What is the thinking behind this? Many production implementations of markdown automatically link all matching URLs. Adding another slightly more convenient way to link to URLs without a title is not really autolinking, just different linking syntax. The spec is explicit about not automatically linking a URL without the <> around it.


#2

I guess this “feature” exists because it was part of the original Markdown.

But having never ever used that, I agree that this does not really make much sense to me, and the word “autolinking” is definitely misleading.


#3

While that’s not “autolinking” as commonly understood, I think it’s a safer and more precise option than actual autolinking. A couple of cases come to mind:

  1. I’m using URLs in text, but don’t want them to be converted to links (for processing or SEO reasons)
  2. I want to explicitly specify a link. With the new TLDs like .travel and .place, traditional auto-linking becomes unreliable. Using the brackets for something like <air.travel> both lets me omit the http:// I’d have to use anyway and ensures that the linked text is the only thing being linked.

What is the point of limiting URI schemes in autolinks?
#4

+++ andre_d [Sep 03 14 20:43 ]:

Currently in this spec autolinking is not automatic, autolinks must be
inside <>. What is the thinking behind this? Many production
implementations of markdown automatically link all matching URLs.
Adding another slightly more convenient way to link to URLs without a
title is not really autolinking, just different linking syntax. The
spec is explicit about not automatically linking a URL without the <>
around it.

It is actually very difficult to give accurate heuristics for
recognizing URLs (which might include punctuation) without including
trailing punctuation. Putting these messy heuristics into the spec
seemed the wrong thing to do. There are fast libraries for autolinking
that can be run over the output of stmd, such as
rinku, so our thought was that the
markdown implementation itself need not do this.


#5

As it currently exists you would be in violation of the spec by doing so. The spec is explicit that http://google.ca is not an autolink. Perhaps the spec could include language to allow expansion there?

edit: not an autolink, and what output it should produce


#6

lmsky’s point 1

I just had a problem with github / basecamp (although it’s not using MD) autolinking texts. If I specifically DO NOT want these to be links, but only plain text, I can’t make that happen. Having the option to add is good. Not having the option to remove is not good.


#7

Most Markdown implementations achieve auto-linking of URLs appearing in free text by having a pre-processing step that wraps any text that looks like a URL in angle brackets. Free-form link recognition is a nasty problem with tons of edge cases. To give just one set of examples:

... many lists (just see http://en.wikipedia.org/wiki/List_of_lists_of_lists)
... meta pages (like http://en.wikipedia.org/wiki/Disambiguation_(disambiguation))
... it's s called a closing parenthesis (see http://en.wikipedia.org/wiki/))

On the other hand, the angle bracket syntax is fairly unambiguous. Not 100%, mind you, but it’s much rarer for a URL or normal text to contain an angle bracket than one of various punctuation characters that commonly appear in both normal text and URLs, like parentheses, periods, question marks etc.

Thus I don’t think the standard should prescribe an exact form of free-text link recognition, but I assume that many SMD implementations will have an option to enable it, using various different approaches, and I’m fine with that. This is a huge problem way outside the scope of Markdown.


#8

What if you’re writing examples of html tags? How do you write < code> without it being interpreted as an actual html tag, OR being autolinked?


What is the point of limiting URI schemes in autolinks?
#9

It won’t be autolinked because by definition of the autolinking you need a scheme.

But in general, writing examples of html tags requires you (and makes sense semantically) to wrap them in code spans:

The `<article>` tag is a good example of [semantic HTML](http://en.wikipedia.org/wiki/Semantic_HTML).

If for whatever reason you don’t want to do that, you have to use &lt; instead of <.

These things are no different in SMD compared to original Markdown.


#10

Point 2 is a bit hard to implement because it conflicts with HTML tags: what if you want an autolink to the code relative URL: <code>.

We could make a list of HTML5 tags, but then still it would be hard to predict which ones are valid or not, and code would break as new tags are added.


#11

That’s an interesting point, but you can filter out URLs and relative anchors with the dot and the hash, respectively. No HTML tags look like <code.tag> or <#code>.


What is the point of limiting URI schemes in autolinks?