4 ms·
If the author of this blogpost is reading this and wondering why the link in the post didn't render properly: > (their move to using Gitea)[https://code.blende
by phinnaeus 4y ago
If the author of this blogpost is reading this and wondering why the link in the post didn't render properly:
> (their move to using Gitea)[https://code.blender.org/2022/07/gitea-diaries-part-1/ https://code.blender.org/2022/07/gitea-diaries-part-1/]
it's because you switched up which braces go where for a markdown link. should be [text](link)
- girvo 4y agoI constantly make that mistake. I don't know why, I simply can't seem to get the muscle memory right for some reason, and I always do ()[] first.
- lbotos 4y agoI always remember it as alphabetical order, brackets then parens, b then p.
- kretaceous 4y agoI remember it as calling a function. :) nameOfLink(url)
- chrismorgan 4y agoWell, [text](href) is just a lousy syntax. Quite apart from how easy it is to forget which way round it is, the way round that it is is syntactically problematic: the parentheses are URL code points <https://url.spec.whatwg.org/#url-code-points https://url.spec.whatwg.org/#url-code-points>, so URL encoding won’t percent-encode parentheses, so Markdown doesn’t actually support all valid URLs, leading to injection attacks if all you do is regular URL encoding, deliberate or accidental, and deciding where an href ends is troublesome and inconsistent, with some Markdown implementations terminating at any right parenthesis, and others trying to match parentheses as a heuristic that helps most cases. The other way round, with the href in square brackets, would have been better in this regard, as square brackets aren’t URL code points, and thus will be percent-encoded. But better still would have been to lean on angle brackets more, matching long-held custom and the other style of links Markdown already uses (just plain <href>). In my own lightweight markup language that I’ve been working on for a while and am now polishing up and implementing properly, I’m currently using [text <href>]. [text]<href> is also quite tempting, with slightly different trade-offs. (When I speak of the details of URL encoding and which characters get percent-encoded, these things weren’t quite so clearly-defined back in 2004 as they are now, but I believe it was all still true.)
- xorcist 4y agoBrackets are a perfectly normal way to stylize references in every other context [1]. I don't know why Gruber made it backwards in Markdown but it was very clearly a mistake. -- [1] Like this.
- zimpenfish 4y agoTo be fair, you can -kinda- do Markdown links like that with the [text][reference] style. (Although I suppose not everyone supports that - it appears HN doesn't, for starters...) [reference]: https://example.com/ https://example.com/
- chrismorgan 4y agoHN doesn’t use Markdown in any way, shape or form, so of course it doesn’t do anything special with it. But anything that does actual Markdown will handle it.
- techknowlogick 4y agoHi, thanks! I'm the author of the blog post, and I'm not sure if you were the person who pointed it out in chat, but I have since fixed it thanks to that heads up.