Skip to content

Markdown: Capture right parenthesis as part of url - #26449

Merged
Matt Bierner (mjbvz) merged 3 commits into
microsoft:masterfrom
kdmu:vscode-25870
May 19, 2017
Merged

Matt Bierner (mjbvz) merged 3 commits into
microsoft:masterfrom
kdmu:vscode-25870

Conversation

@kdmu

@kdmu kdmu commented May 11, 2017

Copy link
Copy Markdown
Contributor

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

@msftclas

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
Copy Markdown
Contributor

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

kdmu commented May 17, 2017 •

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing! Matt Bierner (@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

kdmu commented May 18, 2017 •

Copy link
Copy Markdown
Contributor Author

Matt Bierner (@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
Matt Bierner (mjbvz) merged commit 09c97bc into microsoft:master May 19, 2017
@mjbvz Matt Bierner (mjbvz) added this to the May 2017 milestone May 19, 2017
@mjbvz

Copy link
Copy Markdown
Contributor

Great! Thanks for the follow up on this.

The change will be available in the next insiders build

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