Renaming attachment then updating links causes damaged link in markdown syntax

Steps to reproduce

In the editor, write down the following embedded links:

some text

![Beautiful image](assets/A%20beautiful%20image.png)

![Beautiful image](<assets/A beautiful image.png>)

Make sure you have the assets/A beautiful image.png file relative to the note.

And then right click on the first link, rename it to My dear daughter.png, and update links

Expected result

The content should become like this:

some text

![Beautiful image](assets/My%20dear%20daughter.png)

![Beautiful image](<assets/My dear daughter.png>)

Actual result

The content will actually become to this:

some text

![Beautiful image](assets/My%20dear%20daughter.png)

![Beautiful image](assets/My%20dear%20daughter.png beautiful image.png>)

The second link is totally damaged.


  • Operating system: Windows10
  • Obsidian version: 0.12.4

Additional information

I know, some guys will say:

Why you’d use ![Beautiful image](<assets/A beautiful image.png>) that kind of strange syntax? It is not a correct syntax!

Actually, it is ==a correct and beautiful markdown syntax==, you can find it at CommonMark Spec Example 486, it’s explain is:

The destination can only contain spaces if it is enclosed in pointy brackets

It’s kind of surprising me that few people know this syntax, and even some other developers don’t know that too!

Next, what is the reason to use this syntax? Well, mainly because it’s intuitive, tidy, beautiful, and commonly supported by other Markdown editors.

You can compare these examples:

![Beautiful image](assets/A%20beautiful%20image.png)
![Beautiful image](<assets/A beautiful image.png>)

![My dear daughter](assets/My%20dear%20daughter.png)
![My dear daughter](<assets/My dear daughter.png>)

![One file](assets/A%20long%20file%20name%20with%20spaces%20in%20it.pdf)
![One file](<A long file name with spaces in it.pdf>)

The pointy bracket way is more intuitive! And more importantly, it is compatible with most Markdown editors, since this syntax is a part of the Commonmark Spec.

Expected enhancement

  • Repair the updating link bug to the pointy bracket syntax
  • When using Markdown links, inserting a file whose name have spaces, use the pointy bracket instead of replacing spaces into %20

A post was merged into an existing topic: Support Internal links with standard markdown angle bracket syntax