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

Markdown Hover images broken #80352

Closed
KamasamaK opened this issue Sep 5, 2019 · 8 comments

Comments

@KamasamaK
Copy link

commented Sep 5, 2019

  • VSCode Version: 1.38.0
  • OS Version: Windows 10

I have hovers as MarkdownString containing the following:

[![alt text](${imageUri})](${linkUri})

The imageUri is a file URI to a local PNG image. Instead of the image, it now shows
image with the alt text.

This issue started with v1.38.0, so is a regression.

@vscodebot vscodebot bot added the new release label Sep 5, 2019

@KamasamaK

This comment has been minimized.

Copy link
Author

commented Sep 5, 2019

I've done some searching and found a similar issue microsoft/vscode-remote-release#465. Note that this is not using any remote dev. The recommendation in microsoft/vscode-remote-release#465 (comment) from @jrieken is what I was following, which is to use vscode.Uri.file(extensionContext.asAbsolutePath(...)).toString().

I've used the integrated element inspector and found that the <img> tags only have an alt.

@sbatten

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

assigned to @jrieken since you might know more

@jrieken jrieken assigned jrieken and mjbvz and unassigned jrieken Sep 6, 2019

@jrieken

This comment has been minimized.

Copy link
Member

commented Sep 6, 2019

@KamasamaK Do you have a pointer to your extension - sources or extension itself?

@jrieken

This comment has been minimized.

Copy link
Member

commented Sep 6, 2019

I could reproduce with kisstkondoros.vscode-gutter-preview

h3 {
    color: red;
    background-image: url("./symbol-sprite.svg")
}
  • have above CSS snippet, make sure that the SVG exists
  • hover over "symbol-sprite"
  • 🐛 no images is shown, the insane library seems to remove the src attribute 😱

Screenshot 2019-09-06 at 10 43 24

@jrieken

This comment has been minimized.

Copy link
Member

commented Sep 6, 2019

@mjbvz The seems to be that we don't allow the file scheme. I am not sure if that's on purpose or an oversight. Then the vscode-remote scheme is missing as well.

@jrieken

This comment has been minimized.

Copy link
Member

commented Sep 6, 2019

The issue might actually be bigger, e.g I can contribute a file system for the foo-scheme and it should be valid/possible to generate links like so [path.foo](foo:///some/path.foo). I think we should remove the scheme restriction all together. Risky links should still be taken care of with this:

|| href.match(/^data:|javascript:/i)

@jrieken

This comment has been minimized.

Copy link
Member

commented Sep 6, 2019

Ok, it looks like insane cannot be configured to allow all schemes... Unless I am missing something with insane we might need to extend MarkdownRenderOptions with a set of schemes that we populate at the places that have service access (requires to add IFileService#schemes)

@vscodebot vscodebot bot removed the new release label Sep 8, 2019

@jrieken jrieken added this to the August Recovery 2019 milestone Sep 9, 2019

@mjbvz

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2019

I suspect that file will cover the vast majority of use cases (and is the safer fix for a recovery)

@mjbvz mjbvz closed this in d6dab59 Sep 9, 2019

mjbvz added a commit to mjbvz/vscode that referenced this issue Sep 9, 2019
mjbvz added a commit that referenced this issue Sep 9, 2019

@jrieken jrieken added the verified label Sep 11, 2019

@jrieken jrieken removed their assignment Sep 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.