Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove angle brackets when checking the scheme #133419

Merged
merged 2 commits into from Oct 4, 2021

Conversation

codingLogan
Copy link
Contributor

Summary

When the link is being checked for a known scheme in a markdown file, the scheme wasn't being recognized when encased inside of angle brackets < and >. This change strips the link of beginning and ending < and > so the scheme can be properly checked.

This only removes the brackets during the scheme check if the initial link provided actually has angle brackets. Otherwise it will just use the given link as usual.

Issue

This PR fixes #132974

Testing (Currently Released Build)

Begin editing a markdown file, and enter the following text into the file. If you attempt to command + click or control + click the link in the markdown file you are editing, it won't open in a browser. (note it will open from the markdown preview, just not the editable markdown file)

[Bad - Opens file](<http://google.com>)

Testing (Fixes)

With the code changes applied, you can enter the same text in a markdown file, and the link will open up as expected in the browser. (and it will still open from the markdown preview).

This only removes the brackets during the scheme check if the initial link provided actually has angle brackets.
Copy link
Contributor

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look. Just a few minor points of feedback

extensions/markdown-language-features/src/util/links.ts Outdated Show resolved Hide resolved
extensions/markdown-language-features/src/util/links.ts Outdated Show resolved Hide resolved
@mjbvz mjbvz added this to the October 2021 milestone Sep 27, 2021
Change to use replace instead of match for easier reading
@codingLogan
Copy link
Contributor Author

@mjbvz I made those changes you suggested, and thank you for reviewing the PR. Let me know of any further changes you may think of.

@codingLogan codingLogan requested a review from mjbvz October 1, 2021 02:18
@mjbvz mjbvz merged commit 35ea6c0 into microsoft:main Oct 4, 2021
@mjbvz
Copy link
Contributor

mjbvz commented Oct 4, 2021

Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2021
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.

Syntax Highlighting and Opening Link error in Markdown file
2 participants