gingko / client

Gingko Writer. Tree-based writing software, written in Elm.
https://gingkowriter.com
MIT License
361 stars 49 forks source link

Insert Offline Images #137

Open AdrianoFerrari opened 5 years ago

AdrianoFerrari commented 5 years ago

Currently, it's possible to insert images by URL (which can point to a local file, or an online one).

Ideally, it'd be possible to insert an image from a local file, and have that data embedded in the *.gko file itself.

ds-aufstehen commented 5 years ago

Maybe this should be put into a separate ticket, but in a Word export the images should also be available (currently the markdown text is inserted in their place).

AdrianoFerrari commented 5 years ago

When I try this, the image gets inserted correctly in the Word Export if they're online, but are not shown or exported if they're local files. Is that what you mean?

ds-aufstehen commented 5 years ago

Ah, that's correct. I only work with offline images, so I didn't notice that it works with online ones :)

AdrianoFerrari commented 5 years ago

Can you try this: remove the file:// from in front of the offline image paths... in my tests this makes it show up in both Gingko and exported Word.

gottlike commented 5 years ago

(switched accounts, noticed that I was posting with the wrong one)

I'm on Linux and have just the absolute path, no prefix (/home/gottlike/.../test.png).

AdrianoFerrari commented 5 years ago

Same here (Linux, absolute paths), and works for me.

Alright, will continue to look into this. Thanks for the feedback!

gottlike commented 5 years ago

This is the markdown I used:

![screen](/home/gottlike/something/something/some thing/test2.png)

Maybe it's the space in the path?

Edit: Also, I use uppercase and lowercase in some folders.

AdrianoFerrari commented 5 years ago

You're right, it does seem to be the spaces in the path: https://spec.commonmark.org/0.21/#link-destination

In theory, enclosing the path in angle brackets ![](</home/..../test2.png>) is supposed to address this, but doesn't seem to work (visible in Gingko, not in export). Might be an issue with the pandoc markdown → docx conversion.

What does work is replacing spaces with %20 like this:

![](/home/adriano/Downloads/gingko%20homepage%20with%20spaces.png)

It's a pain, I know! Will keep all this in mind when I work on properly embedding offline images. Thanks for your work in figuring this out

gottlike commented 5 years ago

Alright, thanks for investigating. At least we have a workaround now :)

brainchild0 commented 4 years ago

Ideally, it'd be possible to insert an image from a local file, and have that data embedded in the *.gko file itself.

It might be ideal in certain ways, but further questions are worth considering: