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

Syntax Highlighting and Opening Link error in Markdown file #132974

Closed
ntnyq opened this issue Sep 13, 2021 · 1 comment · Fixed by #133419
Closed

Syntax Highlighting and Opening Link error in Markdown file #132974

ntnyq opened this issue Sep 13, 2021 · 1 comment · Fixed by #133419
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders markdown Markdown support issues verified Verification succeeded
Milestone

Comments

@ntnyq
Copy link

ntnyq commented Sep 13, 2021

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.60.0
  • OS Version: MacOS 10.14.3

Steps to Reproduce:

  1. Copy & paste [foo-bar](<https://foo-bar.com/foo-bar(foo-bar).ext>) into markdown file
  2. Press and click the link

Click here, It works with GitHub's markdown syntax

@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities markdown Markdown support issues labels Sep 14, 2021
@codingLogan
Copy link
Contributor

This is my first go at launching into the vscode code, but hopefully this information may be useful.

Suggestion

Perhaps we could update the parsing of the URI schemes in general to strip out the angle brackets when editing markdown?

See my findings below for why I'm suggesting this, but I'm also unsure of what problems and side effects doing that may cause.

Summary of findings

Main points of interest

  • While the Command + Click doesn't follow the web link when you're editing a Markdown file, it does follow the link in the preview of the Markdown file. So I think markdown syntax is actually ok
  • In debugging the project a little bit, I found that the link you try to follow that has angle brackets may be trying to open a file or something similar (instead of open a web browser)

Bad and Good Link Examples

[Bad - Opens file](<https://foo-bar.com/foo-bar(foo-bar).ext>)

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

[Good - Opens browser Link](https://foo-bar.com/foo-bar(foo-bar).ext)

[Good - Opens browser Link](http://google.com)

Code Areas

In the function parseLink, I think the scheme of http(s) isn't recognized because of the < > brackets in the link portion. See extensions\markdown-language-features\src\features\documentLinkProvider.ts around line 18, where it tries to recognize the scheme, but doesn't recognize it when it tries calling getUriForLinkWithKnownExternalScheme

In the file extensions\markdown-language-features\src\util\links.ts you can add a few new schemes, and then you're able to follow the link just fine. Though, this is probably not the final way the issue should be fixed

export const Schemes = {
	...

	http: 'http:',
	https: 'https:',
	httpb: '<http:',
	httpsb: '<https:',

	...
};

@mjbvz mjbvz added this to the October 2021 milestone Oct 4, 2021
@jrieken jrieken added the verified Verification succeeded label Oct 26, 2021
@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
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders markdown Markdown support issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@jrieken @codingLogan @mjbvz @ntnyq and others