0

If this does not classify as a (probably anyway), then I would like to present this as a for convenience when copy-pasting certain URLs.

The [Title](URL) markdown does not recognize URLs that are missing a scheme/protocol. For example:

[Crittercism](www.crittercism.com/register?codez=ihdqcwduji)

I know RFC 1738 and RFC 3305 would not consider this as a valid URL (due to the lack of a scheme), but it would be nice if the Markdown engine converted this to a hyperlink anyway because of the [Title](URL) directive.

The logic seems fairly straightforward: If whatever is inside the ( ) does not start with a valid scheme (Here's a full list of Official IANA Uniform Resource Identifier Schemes), then prepend http:// to the text inside ( ). Or, to cut out most false-positives, prepend only to URLs starting with www (no scheme).


Example

Without http:// it shows the title, but no clicky linky:

Crittercism - Real Time Crash Reports for iOS & Android Apps!

[Crittercism - ...](www.crittercism.com/register?codez=ihdqcwduji)

With http:// it works as intended:

Crittercism - Real Time Crash Reports for iOS & Android Apps!

[Crittercism - ...](http://www.crittercism.com/register?codez=ihdqcwduji)
2
  • 2
    What problem does this solve? If you're being lazy/efficient in your link adding—or somehow don't know about http://—you're almost certainly copy-pasting URLS from address bars/hyperlinks and would always have the correct scheme anyway. No UA that I know of drops the http:// when copying a URL.
    – user149432
    Feb 4, 2012 at 23:18
  • 1
    @M The main problem is that the markdown kind-of half parses it and makes it appear that the url was converted properly b/c it only shows the text from the [] and I figure it would take maybe 5 minutes to implement a fix. Not a huge benefit, but a quick fix so why not ).
    – chown
    Feb 5, 2012 at 0:28

1 Answer 1

14

The [TITLE](URL) markdown does not recognize urls that are missing a scheme/protocol

If you mean absolute/external URLs that start with a domain component, well, neither does the href attribute in HTML. The protocol is required for absolute URLs, otherwise they'll just be treated as relative URLs which, for this particular site, end up ignored and not rendered as links.

I see no reason Markdown should allow something that HTML doesn't.

If you insist on leaving out the protocol, the syntax for protocol-relative URLs includes the double slashes:

[Crittercism - ...](//www.crittercism.com/register?codez=ihdqcwduji)

Crittercism - Real Time Crash Reports for iOS & Android Apps!

3
  • 5
    // sounds like a bad idea. I think it'll break once SO allows https, but the other site doesn't. Feb 5, 2012 at 15:10
  • 2
    Thats actually pretty cool that you can leave out the protocol and still include the root // and it works. I guess I'll just have to be less lazy and double check the urls after pasting them in ).
    – chown
    Feb 6, 2012 at 18:01
  • Markdown should not allow something that HTML doesn't? Well, it's for documenting - I'd like to have plain hostname there without a protocol to enable people to copy it simply with a right click and tools like putty do not want protocol filled in... \_(-.-)_/
    – Betlista
    Apr 18, 2023 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .