4 ms·
What’s wrong with the link syntax and what would an alternative be?
by dpark 9mo ago
What’s wrong with the link syntax and what would an alternative be?
- evnp 9mo agoAnything that doesn't force you to remember arbitrary ordering - square brackets first? Or parentheses? It's the textual equivalent of plugging in usb upside down. An alternative would be to simply use square brackets for both clauses of the link.
- setopt 9mo ago> An alternative would be to simply use square brackets for both clauses of the link. For comparison, Org-mode uses [[LINK][DESCRIPTION]] instead of [DESCRIPTION](LINK).
- evnp 9mo agoThis is great! Not an emacs user (as yet) but this and org-mode's /italic/ _underline_ *bold* +strike+ feel that much closer to the oft-touted "source looks kinda like formatting” ideal of markdown. Not sure why we ended up with the mediocre version as a defacto standard.
- macintux 9mo agoThe only keyboard shortcut for org-mode and markdown-mode I consistently remember is C-c C-l for inserting links. Much easier to remember that than to remember the syntax, and the fact that both modes use the same easy-to-remember shortcut is a major win.
- setopt 9mo agoSadly, most other keybindings differ between org-mode, markdown-node, and auctex. I would have loved more consistency, and often end up typing the syntax instead of tripping up keybindings.
- simonkagedal 9mo agoSomeone (maybe on this site) suggested to think of the bottom bars of the square brackets around the linked text to kind of frame the underline. Somehow worked really well for me, haven’t forgotten the syntax since.
- evnp 9mo agoI like this, thank you.
- dpark 9mo agoI think it’s a natural outgrowth of the way links are commonly provided in plaintext, like so much other markdown. > The details can be found at my website (https://example.com https://example.com). The problem with this is that if you want to render this “pretty”, there’s no way to know whether the link should be “my website” or “website” or even the whole sentence. So you add brackets to clarify. > The details can be found at [my website](https://example.com https://example.com). There are certainly alternatives but I don’t think any of them are more natural, or memorable for that matter.
- evnp 9mo agoMy issue is remembering that the square brackets come first, not the parentheses. I do like asciidoc's method: https://example.com https://example.com for bare link, or https://example.com[pretty https://example.com[pretty text] if alternate text is desired Edit: It took me a re-read to fully understand your comment, I can see how square brackets might be an incremental addition. This may also help remember the syntax, thanks!
- dpark 9mo agoThat asciidoc format also seems very reasonable. The big issue isn’t specifically that markdown is wrong or right but that all these different systems are very inconsistent.
- chrismorgan 9mo agoExcerpt from my notes when I was deciding on a link syntax for my own lightweight markup language: AsciiDoc doesn’t actually have a real link syntax—what it has is more or less an natural consequence of other syntax choices, but isn’t actually URL-aware, and will mangle some less common URLs. Still, what you get is mostly this kind of thing: • https://example.com[Link https://example.com[Link text] • link:URL[Link text] But woe betide you if you go beyond what it supports, its techniques when you need escaping are grotesque, monstrous horrors. Seriously, when you fall off the happy path, AsciiDoc is awful.
- chrismorgan 9mo agoTwo things wrong with it: 1. People have a hard time remembering the order and which characters to use. The most common error I see is (text)[href]. Spaces in between the [text] and (href) is also common. 2. ( and ) are URL code points: they can exist in URLs without being percent-encoded. This means that you can’t just paste or emit regularly serialised URLs, you also need to change any ( to %28 and ) to %29. To fix it, you start out by using <> to delimit the URL instead of (). This fixes the serialised URL problem (< and > aren’t URL code points), and it was the traditional delimition of URLs too, where delimition was required. You could say that () was common too, but I’d argue that was just normal linguistic parenthesis rather than URL delimition. Markdown even uses <> as URL delimition already, but only for links with no custom text (called “automatic links” in Gruber’s definition, “autolinks” in CommonMark): “https://example.com https://example.com” is just text, “<https://example.com https://example.com>” makes it a link. As for the way of adding a title attribute to a link, that shows that the parentheses aren’t even actually delimiting the URL. And then you get into the mess that’s […] and […][…], in addition to […](…). It’s an ill-considered mess.
- dpark 9mo ago1. Seems unavoidable because there is no natural order for these two elements. It happens that html puts the link first but any time I’m writing I would put the link second. 2. I guess that’s fair. I think parentheses in urls are a bigger issue than parentheses in markdown though. Parentheses in urls often end up percent encoded whether they need to be or not. > You could say that () was common too, but I’d argue that was just normal linguistic parenthesis rather than URL delimition. Right. I would say that markdown is inspired more by linguistic styles than markup styles. You certainly could use <>, but I actually don’t think that matches the way people usually write urls in non-markup formatting. I find it interesting that Gruber chose to use that for autolinks, though. I do appreciate you clarifying. I see what you mean, at least with respect to all the issues around #2. The more I use markdown, though, the more I come up appreciate this format, specifically because it’s so readable as text. I think it’s a reasonable trade off.
- chrismorgan 9mo ago