obsidian-link-converter icon indicating copy to clipboard operation
obsidian-link-converter copied to clipboard

Issue when converting links that contain parenthesis

Open joesfer opened this issue 3 years ago • 0 comments

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

joesfer avatar Jan 01 '22 20:01 joesfer