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

Support file: URLs (and absolute paths) for images #92

Open
PoeppingT opened this issue Feb 7, 2022 · 6 comments
Open

Support file: URLs (and absolute paths) for images #92

PoeppingT opened this issue Feb 7, 2022 · 6 comments

Comments

@PoeppingT
Copy link

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.

Cimbali added a commit that referenced this issue Feb 7, 2022
Cimbali added a commit that referenced this issue Feb 7, 2022
@Cimbali
Copy link
Owner

Cimbali commented Feb 7, 2022

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 Cimbali closed this as completed Feb 7, 2022
@PoeppingT
Copy link
Author

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")

@PoeppingT PoeppingT changed the title Support images Support local images Feb 8, 2022
@PoeppingT
Copy link
Author

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

@Cimbali Cimbali reopened this Feb 8, 2022
@Cimbali
Copy link
Owner

Cimbali commented Feb 8, 2022

Interesting. This seems to work for relative paths, but not with full file:// URLs.

@PoeppingT
Copy link
Author

Relative paths works for me as a workaround! Thanks

@Cimbali Cimbali changed the title Support local images Support file: URLs (and absolute paths) for images Jun 7, 2022
@Cimbali
Copy link
Owner

Cimbali commented Jan 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants