Support `file:` URLs (and absolute paths) for images
PoeppingT opened this issue · 6 comments
The markdown reference site lists the common markdown syntax for images as the same as a link, i.e.
[link text](http://link.target)
but with a preceding !, e.g.
![image alt text](http://image.jpg "image hover text")
This should be relatively easy to implement: when matching that pattern in the source markdown, inject an HTML <img>
tag to the rendered HTML.
When I get time I plan on working on this.
Images are already working, including hover text. I’ve made sure that a demo of that is in the test files as well. If you have an example where this syntax doesn’t work, please feel free to reopen this issue with details to reproduce.
Just tested, you're right: images work for web images. Not for local images though, and I'm using this for pretty markdown rendering of personal notes on my local filesystem.
e.g.
// works
![example_image2](https://avatars.githubusercontent.com/u/4009272?v=4 "hover text")
// doesn't work
![example image](file:///Users/me/Documents/Notes/Resources/PXL_20211207_224630876.jpg "hover text")
Images are already working, including hover text. I’ve made sure that a demo of that is in the test files as well. If you have an example where this syntax doesn’t work, please feel free to reopen this issue with details to reproduce.
@Cimbali looks like I can't reopen the issue if it was closed by you, but I've commented the reproduction above and changed the issue title
Interesting. This seems to work for relative paths, but not with full file://
URLs.
Relative paths works for me as a workaround! Thanks
I think we could rewrite all local paths as relative, specifically only for injecting in local pages. V2 (#99) already has some src/href rewriting so we can just extend that. Not sure that it would work across drive letters on windows.
Also this feels like something that could be exploited by malign extensions to probe the filesystem, so I wouldn't rely on it. Firefox may disable this workaround at any point.