Re:Open source sustainment and the future of Gitea
by girvo on Wednesday October 26, 2022 @12:47AM
(#33339939)
I 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.
Re:Open source sustainment and the future of Gitea
by chrismorgan on Wednesday October 26, 2022 @01:18AM
(#33340097)
Well, [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>, 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.)
Re:Open source sustainment and the future of Gitea
by lbotos on Wednesday October 26, 2022 @01:24AM
(#33340125)
I always remember it as alphabetical order, brackets then parens, b then p.
Re:Open source sustainment and the future of Gitea
by kretaceous on Wednesday October 26, 2022 @03:01AM
(#33340658)
I remember it as calling a function. :)
nameOfLink(url)
Re:Open source sustainment and the future of Gitea
by xorcist on Wednesday October 26, 2022 @05:33AM
(#33341487)
Brackets 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.
Re:Open source sustainment and the future of Gitea
by zimpenfish on Thursday October 27, 2022 @01:07AM
(#33353350)
To 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/
Re:Open source sustainment and the future of Gitea
by chrismorgan on Thursday October 27, 2022 @01:23AM
(#33353449)
HN 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.
Re:Open source sustainment and the future of Gitea
by techknowlogick on Wednesday October 26, 2022 @03:59PM
(#33348593)
Hi, 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.
> (their move to using Gitea)[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)