-
Notifications
You must be signed in to change notification settings - Fork 185
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
Hover popup does not render images from the internet #1363
Comments
Just wondering
|
I can’t remember if it worked before cause I just stumbled upon this one document that had pictures in it.
Language is dart and server is LSP-Dart.
…Sent from my iPad
On Oct 5, 2020, at 11:36 PM, Jack Cherng ***@***.***> wrote:
Just wondering
does it work before?
what's the language and the server?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
It would be good to know the LSP payload from the server for this hover request, so we can see how the Dart server handles images. I can say that in general images in hover popups work for me with e.g. the TexLab server, and that server uses Markdown markup for it, with the image encoded as a png/base64 string. But I don't use Dart and don't want to install the Dart SDK just for this, so maybe you could paste it here? To show the server payload, I believe on ST4 you need to set |
Thank you for the instructions! Here's the log specific to the hover event:
Looks like its .png's that are not showing correctly. If I look up for any of the links, this is what I get: |
As far as I know mdpopups doesn't handle image URLs:
Only @facelessuser can tell for sure :) |
Yes, according to the docs, ST doesn't support http(s) urls in Something like this: import urllib.request
from base64 import b64encode
url = "https://flutter.github.io/assets-for-api-docs/assets/material/Colors.pinkAccent.png"
try:
img = urllib.request.urlopen(url).read()
img_base64 = b64encode(img).decode()
view.show_popup('<img src="data:image/png;base64,{}" />'.format(img_base64)) |
MdPopups does not and should not be downloading images. If image lings are to be handled, Sublime itself should do such things. So if you need to make remote images available, you will have to have them locally. With that said, base64 images should be the image data not the URL. |
Looks like there is already an issue for this in the ST issue tracker: sublimehq/sublime_text#1378 So the only possibilities to support this would then be to download and convert image links in the LSP package, or ask the language server maintainers to provide base64 encoded image strings instead of internet URLs. |
A small piece of the puzzle is now implemented in mdpopups: facelessuser/sublime-markdown-popups@7b5eece |
Looks like we are slowly getting there! |
Description
The window that appears when you hover over when looking for documentation about a class/object/function is not rendering images correctly on latest ST4:
The rendered images should be as follows:
Steps to reproduce
First step: hover over any class/object/function (that has images in its documentation) to view the documentation
Second step: Scroll to the part of the documentation that has images in it
Images don't show
Expected behavior
Images should show on the documentation window
Actual behavior
Images show as missing (missing icon)
Environment
Build: 4087
Operating system and version: MacOS 10.15.7
The text was updated successfully, but these errors were encountered: