Skip to content

Conversation

@idbrii
Copy link
Contributor

@idbrii idbrii commented Apr 21, 2025

Fix #168.

Use URI pattern matching so the trailing ) is excluded in markdown links even when g:openbrowser_allowed_schemes is set. That option should modify how we select schemes (head) and not the uri pattern.

Bug introduced in b8d27c7.

Test

These open correct links:

  -- taken from https://leafo.net/guides/setfenv-in-lua52-and-above.html
  -- taken from http://leafo.net/guides/setfenv-in-lua52-and-above.html
  -- taken from ttps://leafo.net/guides/setfenv-in-lua52-and-above.html
  -- taken from ttps://leafo.net/guides/setfenv-in-lua52-and-above.html
  * [tyru/open-browser-github.vim](https://github.com/tyru/open-browser-github.vim)

Opens https://en.wikipedia.org/wiki/Planetoid_ which Wikipedia correctly redirects. This is the same behaviour as 91573a3 -- before my breaking change.

* [Planetoid](https://en.wikipedia.org/wiki/Planetoid_(disambiguation))

Opens the link if the cursor is on : and searches for tyru if cursor is on [:

* [tyru/open-browser-unicode.vim]( https://github.com/tyru/open-browser-unicode.vim )

This one searches for 'leafo':

  -- taken from tt://leafo.net/guides/setfenv-in-lua52-and-above.html

(The nonmarkdown links are from b8d27c7.)

Fix tyru#168.

Use URI pattern matching so the trailing ) is excluded in markdown links
even when g:openbrowser_allowed_schemes is set. That option should
modify how we select schemes (head) and not the uri pattern.

Bug introduced in b8d27c7.

Test

With config:
    let g:openbrowser_allowed_schemes = [
                \     'https\?',
                \     's\?ftp',
                \ ]

These open correct links:

  -- taken from https://leafo.net/guides/setfenv-in-lua52-and-above.html
  -- taken from http://leafo.net/guides/setfenv-in-lua52-and-above.html
  -- taken from ttps://leafo.net/guides/setfenv-in-lua52-and-above.html
  -- taken from ttps://leafo.net/guides/setfenv-in-lua52-and-above.html
  * [tyru/open-browser-github.vim](https://github.com/tyru/open-browser-github.vim)

This one searches for 'leafo':

  -- taken from tt://leafo.net/guides/setfenv-in-lua52-and-above.html

This opens `https://en.wikipedia.org/wiki/Planetoid_` (which forwards to
a valid page) the same behaviour as 91573a3 (before my breaking change):

  * [Planetoid](https://en.wikipedia.org/wiki/Planetoid_(disambiguation))

The markdown links behave the same way when tested without
g:openbrowser_allowed_schemes defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Includes trailing ) in markdown links

1 participant