ozntel / obsidian-link-converter

Obsidian Plugin to scan all your links in your vault and convert them to your desired format.
173 stars 14 forks source link

Issue when converting links that contain parenthesis #8

Open joesfer opened 2 years ago

joesfer commented 2 years ago

Hi,

I found your plugin really useful -- thank you for sharing.

I would like to let you know about an issue I found when converting markdown to wiki links if these contain parenthesis. The regular expression will incorrectly terminate on the first parenthesis found, thus chopping the link.

This is an example of the link format that will be handled incorrectly:

[some link title](../path/Smith, John (2001). Title Of Book.md)

With some quick testing, a greedy match between the parenthesis seems to match the entire contents correctly:

\[([^\]]*)\]\((.+)\)

Here's my test https://regexr.com/6ci5n

The greedy match might however fail with multiple links in the same line. Hopefully, though, it will serve to illustrate the problem.

Thanks again for your work, Jose