20
votes
Markdown/inline links don't work unless URL starts with http(s)
I figured I can't have been the first to notice this but I can't find any specific mention, and it still trips me up every so often.
If I want to link to Tildes, I can type
http://tildes.net,
https://tildes.net, or
www.tildes.net,
and they format automatically. Simply tildes.net (or blog.tildes.net) doesn't automatically turn into a link, which makes sense.
However, if I do inline links, only the first two will work:
Tildes (http), and
Tildes (https).
Tildes (www) results in Error 422 (Unprocessable Entity), topic_id36: String does not match expected pattern.
Tildes and Tildes (blog) do the same.
I saw the link canonicalization issue on GitLab but I don't know if this would fall under that.
What browser and OS are you using?
Edit: actually, nevermind - I see what the issue is. In Markdown if you are creating a link using the markdown syntax, like so:
Then the protocol is actually required, otherwise it will presume that you are creating a relative link.
I literally just had this happen in Obsidian. It even adds a nice feature that if the file doesnt exist yet in the vault, then clicking the relative link will actually create the file at that location the first time you click it.
Learning new things!
Maybe relative links are less useful for this specific site but it's good hygiene anyways to always include the URL scheme. Markdown links on all other sites will very likely behave like this even if there is a special fix on this site to convert relative markdown links into absolute ones.
I am not familiar with any software or website that uses Markdown and lets you skip including the protocol in this manner, so it seems like intended behaviour to me.
What if you want to link to a different protocol like mailto?
Trivia: you actually can omit the protocol in an absolute URL, it just has syntax that'll look really weird to most people:
//tildes.netfor example
It uses the protocol of the page you're already on.
In my head I always thought of that syntax as still being a relative url--just relative up one level to the scheme instead of any part of the domain name.