Extract all urls into reference-style link

Hi, i think it would be really useful to have a plugin that extracts all links in style:

[link text](https://example.com)


[link text][_1]

% end of document %
[_1]: https://example.com

i often use source mode and if you put 2 or 3+ links on a line, it spans multiple lines. this plugin would make it easy to save space. note: the _1, _2, etc syntax is arbitrary and not exactly required, just an example

the plugin should add

  • A command to extract all links current file into reference-style (bonus points if it also makes sure the references are ordered alphabetically). if all links are already reference style, it would be a no-operation
  • a right click menu on links to extract them into reference-style.

the plugin should also auto-sync the generated references, so if i make links _1, _2 and _3, then delete link _2 in my note, upon calling the command (first command i mentioned above) link _3 should become link _2 both in the note and at the end of the document.


It might be simplest to support the implicit link name shortcut (Daring Fireball: Markdown Syntax Documentation):

[link text][]

% end of document %
[link text]: https://example.com

If you don’t mind putting the link definitions after each paragraph instead of at the end of the document, you could do the implicit style with a saved search-replace in the Patterns community plugin.

If using a label, a setting could allow you to choose text to go before or after the number.

1 Like

There is already such a plug-in. Quite old too. Try a (better) search

Spell it out for us, champ.

Do you mean Footlinks?

1 Like

I had no luck getting the footlinks plugin to work - ran the “refactor current page” on a link-heavy note and it changed absolutely nothing.

in essence, if footlinks worked, it would probably do what this request wants, but as it does not work, i’m not closing this yet.

1 Like

Also, Footlinks doesn’t use the proper term anywhere, so it’s hardly unreasonable if your earlier search didn’t find it.

1 Like