First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.
What I’m trying to do
I would like Obsidian to use commonmark specification by default when I copy and paste a picture or text file within a note.
Things I have tried
Copying and pasting a picture or a text file within a note creates a wikilink instead of a link with the commonmark specification.
I just found out that the <> will be “doubled” every time you save the file. Working on the correct solution…
Here we go. The final version is: (!?\[[^\]]+\]\()\<?([^>)]+)\>?\) + gm + $1<$2>) .
Alternatively, if you want to have it more balanced: (!?\[[^\]]+\])\(\<?([^>)]+)\>?\) + gm + $1(<$2>) .
Or even: !?\[([^\]]+)\]\(\<?([^>)]+)\>?\) + gm +  .
As you can see, there is no one way to skin the cat. I have added a ? after the ! just to be on the safe side regarding non-image linking, i.e., normal MD links.
The regex does cover only one level. In the third example, only the inner MD link (the link text portion) is handled, and the outer one is left untouched. I leave it to you as an exercise.
[Pasted image 20230917184634.png](Pasted image 20230917184634.png "This is a title")

[](Pasted image 20230917184634.png "This is a title")