lukakerr / Pine

A modern, native macOS markdown editor
https://lukakerr.github.io/Pine
Other
3.34k stars 168 forks source link

Preview doesn't render local images #25

Closed skiprca closed 5 years ago

skiprca commented 5 years ago

Hello!

I can't find a way for local image to render properly in preview window.

I use three files for testing:

/Users/johndoe/tmp/aaa.md 
/Users/johndoe/tmp/aaa.png
/Users/johndoe/tmp/aaa/aaa.png - for testing relative subfolder

Nothing of the following seems to work:

![test png 1](aaa.png)
![test png 2](aaa/aaa.png)
![test png 3](file:///Users/johndoe/tmp/aaa.png)
<img src="aaa.png" alt="test png 4">
<img src="aaa/aaa.png" alt="test png 5">

Web link works as it should:

![web png](https://johndoe.com/aaa.png)

I tried to preview same aaa.md in MacDown and it works for all cases.

Am I missing something?

Thank you for your time, Aljoša

lukakerr commented 5 years ago

This is a known bug/missing feature. Unfortunately WKWebView doesn't make it easy to include local assets (including images). I believe MacDown is using the old WebView which makes this easier

skiprca commented 5 years ago

Thank you for a fast response. Do you plan to implement this in near future or should I dig in myself? ;)

Regards, Aljoša On 9 Feb 2019, 00:28 +0100, Luka Kerr notifications@github.com, wrote:

This is a known bug/missing feature. Unfortunately WKWebView doesn't make it easy to include local assets (including images). I believe MacDown is using the old WebView which makes this easier — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

lukakerr commented 5 years ago

@skiprca If your keen then definitely have a go to try and fix it, thanks! I was planning on getting to it some time in the future, but haven't had much time to work on it recently unfortunately

lukakerr commented 5 years ago

I've begun work on this in #32, but as you can read in the PR, there is a small problem i'm facing. If I can't solve it in the next few days, i'll merge the PR in anyway.

noestreich commented 5 years ago

Just stumbled on entry #32 after unsuccessfully trying to get image preview to load. Glad you already started implementing it.

If i may add two comments and a feature-wish:

"If there is a way to implement the syntax ![](pic/location/url =200x) like Mou, or just add an alternative way of Command+Shift+I to input <img src="" width=""> directly."

Thanks a bunch!

lukakerr commented 5 years ago

@noestreich regarding the feature wish list:

noestreich commented 5 years ago

Perfect and reasonable reply all around. Thanks for the fast feedback! Looking forward to use the image preview.

lukakerr commented 5 years ago

The issue in #32 has been fixed! A good nights sleep always resolves any problems. I also implemented both markdown and HTML image shortcuts.

These new shortcuts and the new local image feature will be included in the next release. If there are any issues with images not appearing, please raise a new issue.