Skip to content

Markdown: Capture right parenthesis as part of url#26449

Merged
mjbvz merged 3 commits intomicrosoft:masterfrom
kdmu:vscode-25870
May 19, 2017
Merged

Markdown: Capture right parenthesis as part of url#26449
mjbvz merged 3 commits intomicrosoft:masterfrom
kdmu:vscode-25870

Conversation

@kdmu
Copy link
Contributor

@kdmu kdmu commented May 11, 2017

Fixes #25870
screen shot 2017-05-11 at 12 16 41 pm

@msftclas
Copy link

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@mjbvz
Copy link
Collaborator

mjbvz commented May 17, 2017

Can you take a look at cases like:

[good](https://technet.microsoft.com/en-us/library/bb613488(v=vs.85).aspx) text (other text)

With the current change, the link is incorrectly detected as: https://technet.microsoft.com/en-us/library/bb613488(v=vs.85).aspx)

@kdmu
Copy link
Contributor Author

kdmu commented May 17, 2017

Thanks for reviewing! @mjbvz

I am trying with the following pattern:

/(\[[^\]]*\]\(\s*?)([^\s]+)\)/g

It accomplishes with most of cases including the one you mentioned except ([tag](link)), i.e. referencing within parentheses.
screen shot 2017-05-17 at 8 51 01 pm
I guess it's more natural to think that the first parenthesis is part of markdown syntax and not the second one, however in this scenario we are not interpreting like that given we are capturing as much parentheses as we can instead of capturing as least as possible (Original design) as response to #25870.
I am not sure if we should consider this as an error since there may be another interpretation, what do you think? Btw any pointer is more than welcome, I feel somehow hard to fulfill two contradictory situations.

(Please let me know if we should redirect the discussion to issue)

@kdmu
Copy link
Contributor Author

kdmu commented May 18, 2017

@mjbvz I just pushed a new link pattern and seems to work with my test cases and root README, please let me if is anything is wrong.
screen shot 2017-05-18 at 10 41 54 pm

@mjbvz mjbvz merged commit 09c97bc into microsoft:master May 19, 2017
@mjbvz mjbvz added this to the May 2017 milestone May 19, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented May 19, 2017

Great! Thanks for the follow up on this.

The change will be available in the next insiders build

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with link highlighting in mardown files

3 participants