mathiassoeholm / markdown-link-updater

21 stars 9 forks source link

Changing heading replaces entire line with new anchored link #29

Open aimurphy opened 1 year ago

aimurphy commented 1 year ago

When I change a heading within a file, if there are anchors within the same file pointing to the modified heading, the lines containing those links are wiped out and replaced with only the new link.

I tried uninstalling and reinstalling the extension, but it's still happening.

I did a test to see if this was happening all the time or only in lists, and whether the presence of multiple sentences had an impact. I also tested a regular link - When I moved that file, the link updated as expected with no change to the rest of the line.

Original:

Some text about [Before You Begin](#before-you-begin) and then some more text.

Some text before the sentence with the link. Some text about [Before You Begin](#before-you-begin) and some more text. Some text after the link.

* A list item.
* A list item with [Before You Begin](#before-you-begin) link.
* Some text before the sentence with the link. A list item with [Before You Begin](#before-you-begin) link. Some text after the link.
* A list item with [regular link](../file-path/file.md).

## Before You Begin

And after I changed the heading, these changes automatically happened:

[Before You Begin](#before-you-begin---prerequisites)

[Before You Begin](#before-you-begin---prerequisites)

* A list item.
[Before You Begin](#before-you-begin---prerequisites)
[Before You Begin](#before-you-begin---prerequisites)
* A list item with [regular link](../file-path/file.md).

## Before you begin - prerequisites