Jelmerro / Vieb

Vim Inspired Electron Browser - Vim bindings for the web by design
https://vieb.dev
GNU General Public License v3.0
1.29k stars 61 forks source link

[markdown] Add the possibility to load local resources #530

Closed Melandel closed 7 months ago

Melandel commented 8 months ago

Checklist

Addition or change Provide configurability for loading local resources in certain contexts (or, in markdown file contexts specifically)

Currently, when opening a local markdown file that references an image on my local drive, the image is not displayed.

Console displays the following:

Not allowed to load local resource: file:///C:/foo/bar/baz.png

Alternatives considered -

Jelmerro commented 8 months ago

This is a browser/Electron limitation, as local files are not allowed to load other local files, but I'll see if there's a way around it using custom protocols, ideally in a secure way.

Jelmerro commented 8 months ago

I think this just affects images right? Or is there another resource this applies to that I'm not considering? I have a working prototype for images now, but not sure if this is all there is to it. I don't think markdown has video support, right?

Melandel commented 8 months ago

From what I dug into, I do not think so:

I would tend to consider that markdown does not have video support

Jelmerro commented 8 months ago

Great, that makes things easy for once, I'll have this implemented in V11 (hope to release in a few weeks).

Melandel commented 8 months ago

Thank you for your time and energy always! 😃

Jelmerro commented 7 months ago

Implemented in 11.0.0 :tada:

Melandel commented 4 months ago

Hello,

Oddly enough when I'm trying today I don't see the image getting displayed.

Given that:

Developer Tools indicates the following: image

While firefox finds and displays the image correctly.

Jelmerro commented 4 months ago

Which Vieb version are you using? This is only been fixed in 11.0.0, where I just tried your example with a random image and it works. Are you sure the image exists and you are using 11.0.0? Because I can only reproduce this behavior in older versions of Vieb. Even if the image is missing, it should generate something like this in the HTML: image Instead of using the image directly from disk, as that is not allowed. I'm testing it in the repo with this code: ![](app/img/cheatsheet.png) and it works in 11.0.0 for me. Can you show me the file, file structure, Vieb version and the Elements tab of the devtools using some screenshots?

Melandel commented 4 months ago

Hello,

I'm using 11.0.0 and have created a repro where I detailed how to reproduce the behavior I'm witnessing.

It's here

Jelmerro commented 4 months ago

Since that very same repo works for me, it might be a Windows only issue, given that paths are fairly different/bad there, so I will look into this when I am back at a Windows machine again.

Jelmerro commented 1 month ago

@Melandel I have had the opportunity to work on Windows a short time ago and have made sure both the markdownviewer and filebrowser now work at least when running from source, could you check if the new 12.0.0 release fixes your issue?