2

Using the inline link notation, [SO](stackoverflow.com), results in:

SO

The protocol must be specified, as per the answer by @codeer.

I would like to request the syntax that does not require prefixing https:// be allowed - if https:// would be prepended by default, that would be nice.

13
  • I hope you don't mind me testing this here on Chrome: Stack Overflow // Stack Overflow
    – user9420984
    Dec 14, 2018 at 7:44
  • @Codeer - can you please edit my question with your test? I do not have Chrome right now.
    – kabanus
    Dec 14, 2018 at 7:45
  • Unfortunately I can't because i have <2k rep. But both the shortlinks eg [SO] and the test you did [Stack overflow](https://www.stackoverflow.com) work for me in that comment.
    – user9420984
    Dec 14, 2018 at 7:46
  • [testing](shortlinks.com)
    – kabanus
    Dec 14, 2018 at 7:46
  • 1
    That doesn't work for me either on chrome. Does it work if you add https:// to the link? That might be the cause.
    – user9420984
    Dec 14, 2018 at 7:48
  • 3
    I noticed as well, Prefixing http:// or https:// was a workaround Dec 14, 2018 at 7:48
  • @Codeer Thanks, can you post that as an answer?. I can verify that the workaround works.
    – kabanus
    Dec 14, 2018 at 7:49
  • 1
    Did this ever work without specifying a protocol?
    – Rob Mod
    Dec 14, 2018 at 8:07
  • @Rob I thought a did, but I may be going senile. I will try and look into my older posts.
    – kabanus
    Dec 14, 2018 at 8:07
  • @Rob I think it did not, how embarrassing. I will transform this into a feature request.
    – kabanus
    Dec 14, 2018 at 8:09
  • 1
    I guess I am already senile.
    – kabanus
    Dec 14, 2018 at 8:18
  • @kabanus Well, don't take my word for it. I seem to remember it requiring a protocol, but I'm by no means sure of it
    – Rob Mod
    Dec 14, 2018 at 8:19
  • @Rob all my old questions seem to have a protocol. For the life of me I cannot figure out what made me stop using it.
    – kabanus
    Dec 14, 2018 at 8:20

3 Answers 3

13

There are two main reasons I think this should not be implemented:

  1. Some websites may not work over HTTPS, and it may not be evident to the author of a post he just posted an invalid link

    In the current situation, if you post a link and forget the protocol, you will be reminded you forgot the protocol because the link doesn't format properly in the preview. If you forget the link, it formats properly, but uses the wrong protocol, that's an error that's way less likely to be detected.

  2. It violates the markdown standard

    While Markdown is less standardised than other markup languages, in my opinion, we should stick as close to what's standardised as possible. The documentation on links describes nothing about assuming protocol. If we were to deviate from the standards, that would mean that anyone that were to parse markdown generated by SE (e.g. to automatically detect dead links in popular answers using a dump) would need to deviate from it as well (which can mean a substantial development effort for a small project).

Also, I think the use case is very niche (if you use the link button in the editor the protocol is pre-populated, if you copy-paste from a browser address bar that includes the protocol) so I think there wouldn't be much benefit.

6
  • Note that Stack Overflow may follow commonmark specification which doesn't require the link destination any form of protocol. It's up to the browser to figure out what <href a="stackoverflow.com">link</a> means.
    – Braiam
    Dec 14, 2018 at 14:51
  • BTW, that's exactly what the commonmark specification does spec.commonmark.org/dingus/?text=%5BSO%5D(stackoverflow.com)
    – Braiam
    Dec 14, 2018 at 14:55
  • @Braiam I was about to cite that when I realized they don't follow that specification, since according to the CommonMark specification they should have converted[SO](stackoverflow.com) to <a href="stackoverflow.com">SO</a>, but instead they convert it to just SO as plain text.
    – Erik A
    Dec 14, 2018 at 14:58
  • Well, that's the plan. Maybe we need to check the .net community implementation and if ISS change stuff.
    – Braiam
    Dec 14, 2018 at 17:10
  • @Braiam I think they purposefully deviate from the spec to disallow unsafe or unwanted uri's (things like javascript:, callto:, ms-word: etc.). I also think that likely shouldn't be changed
    – Erik A
    Dec 14, 2018 at 18:04
  • @wizzwizz4 no, it was intentional.
    – Braiam
    Dec 14, 2018 at 18:45
3

The following currently does not work:

SO [SO](stackoverflow.com)

A workaround is to prefix it with http or https:
SO [SO](http://stackoverflow.com)
SO [SO](https://stackoverflow.com)

2

The protocol does not need to be specified for internal links, but you do need to start with a /, though. For example,

SO

which is [SO](/questions) This uses the HTTPS protocol as that's what Stack Overflow is using now.

And two slashes courtesy of wizzwizz4 can get you an external link again without a protocol needing to be specified:

Google [google](//google.com)

Whatever gets implemented as the feature request would have to be compatible with internal links, at least as they are used a lot in tag wikis. Alternatively, we could implement things differently for tag wikis, but I imagine that would be confusing.

7
  • 1
    Interesting, I would not have figured that out. I wonder why the dv? This is useful info.
    – kabanus
    Dec 14, 2018 at 9:35
  • The final link is wrong in this case, leading to a 404
    – CinCout
    Dec 14, 2018 at 9:35
  • @CinCout ahh correct, it prepends meta.stackexchange.com to the url. Likely the current exchange.
    – kabanus
    Dec 14, 2018 at 9:36
  • This link leads to meta.stackoverflow.com/stackoverflow.com
    – user9420984
    Dec 14, 2018 at 9:36
  • @kabanus That is because / appends after the current directory
    – CinCout
    Dec 14, 2018 at 9:36
  • @RobertLongson You were thinking of //, giving SO ([SO](//stackoverflow.com)).
    – wizzwizz4
    Dec 14, 2018 at 18:48
  • @wizzwizz4 I've updated the answer and credited you. Dec 14, 2018 at 20:10

You must log in to answer this question.

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