coding-stylemarkdowncode-structure

Link conventions


There are multiple ways of declaring a link with a title or without. I'm wondering whether there is a preferred way of doing it, either official or widely used in the community.

Taken from markdownguide.org/basic-syntax/#formatting-the-second-part-of-the-link, here are all the ways of declaring reference-style links (this also applies to inline-style links, there would just be a ( instead of : and a ) at the end):

[1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle
[1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle "Hobbit lifestyles"
[1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle 'Hobbit lifestyles'
[1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle (Hobbit lifestyles)
[1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> "Hobbit lifestyles"
[1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> 'Hobbit lifestyles'
[1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> (Hobbit lifestyles)

I assume the whitespace after [1]: should be included, considering they haven't shown this option. Is that correct?

I've looked at the official documentation by John Gruber at daringfireball.net/projects/markdown and it looks like they prefer [name]: link "title".

If there's not a "preferred" way, which one do you use and why? Are any of them functionally different in any way whatsoever?


Solution

  • White space after [1]: should be included it even says so in Formatting the Second Part of the Link: "The label, in brackets, followed immediately by a colon and at least one space"

    My preferred style is [1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle "Hobbit lifestyles". I try to avoid single quotes and brackets.