6

I found that Markdown has something called reference-style links. I don't know if is it official Markdown syntax or it exists only in some Markdown add-ons.

I tried to create something like that in VSCode, but it doesn't work:

[Test][ducksearch]  
[ducksearch]: https://duckduckgo.com

I wonder is it a bug/un-implemented function in VSCode or that syntax works only with some extension?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • For an update on markdown links to folders, see https://stackoverflow.com/questions/42569143/what-is-fragment-link-navigation-for-markdown-in-visual-studio-code/61533841#61533841. – Mark Apr 30 '20 at 22:30

2 Answers2

2

Reference-style links are part of the original Markdown specification. They should work just about everywhere Markdown does, and that includes Visual Studio Code.

Just add a blank line to separate the paragraph containing the link from the reference:

[Test][ducksearch]

[ducksearch]: https://duckduckgo.com
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Is there a better way (best practices) to place the link list, just a new line after the last paragraph in the end sounds for me not the suggested way. – KargWare Mar 10 '20 at 07:25
  • @KargWare, there are no official recommendations about that. The link label can be defined anywhere in the document (even before where it is used). It is common to include them all at the end so they're easy to find, but I've also seen them right after the paragraph. Note that I'm _not_ recommending a specific place here; I'm saying that there needs to be space around them so they get properly parsed. – ChrisGPT was on strike Mar 10 '20 at 13:45
  • 1
    Is there an extension to convert from one to another? – Royi May 18 '21 at 11:41
1

Not only reference-style links are supported natively by VSCode markdown editor, but VSCode 1.68 (May 2022) will enable "go to definition".

See issue 146293

Enable triggering go to definition on a markdown reference link to jump to the link definition

[text][link] // trigger on link here

[link]: https://example.com

Go to def (from text) should jump to the definition of link, at the end of the file

This is implemented in PR 148017, and available in the Insider edition right now.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250