mathiassoeholm / markdown-link-updater

21 stars 9 forks source link

Feature Request: support anchor links #3

Closed BenRoe closed 3 years ago

BenRoe commented 3 years ago

Thank you for the great vscode extension. It would be very useful if the extensions also detects if a headline was renamed and updates the anchor link in the same markdown file.

mathiassoeholm commented 3 years ago

Thanks for the suggestion! I think I will need some sort of example to completely understand it :-)

BenRoe commented 3 years ago

If the headline Headline 1 will be rename to Foobar, the anchor link [Jump to Headline 1](#headline-1) should also be renamed [Jump to Headline 1](#foobar)

## Headline 1

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.

## Headline 2

[Jump to Headline 1](#headline-1) dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
mathiassoeholm commented 3 years ago

I have added it as an experimental feature in version 1.2.1, that you can enable in settings:

image

I will eventually make it enabled by default once it has proven to be stable :-)

BenRoe commented 3 years ago

Thank you for adding it. Tried to test it, but no changes/reaction at all.
I have the latest version 1.2.1 installed. Activated it in the settings, but nothing happen if i edit a headline.

mathiassoeholm commented 3 years ago

That's weird 🤔

It should work like this:

rename

It triggers on save. Might be a stupid question, but are you saving your changes after editing? And what's the specific headline and link in your context?

BenRoe commented 3 years ago

My bad. Forgot that it works on save.

Punctuation at the end work, but for example Foobar's breaks it and other symbolds, too.

mathiassoeholm commented 3 years ago

Should be fixed now in version 1.2.2 :-)

BenRoe commented 3 years ago

Wow you are so fast. Will test it and give you feedback.

mathiassoeholm commented 3 years ago

@BenRoe This feature is no longer behind a flag in the latest version. If you still have this setting in your settings.json, you can safely remove it :-)