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

Feature Request: paste images #46

Closed
gcoimbra opened this issue Sep 12, 2020 · 9 comments
Closed

Feature Request: paste images #46

gcoimbra opened this issue Sep 12, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@gcoimbra
Copy link

Anyway to copy+paste images on notekit?

@blackhole89
Copy link
Owner

blackhole89 commented Sep 21, 2020

You mean to embed images (png, bmp, whatever) into the document? Not at the moment. It's planned; I just need to figure out a good way of storing them (should they be forced inline with long data: URI blobs, or should notekit create a separate subfolder to store embedded images in?).

You should be able to copy and paste your own drawings without issue.

@gcoimbra
Copy link
Author

Yes, I meant that.
I think it would be better if they're inlined. This way if you can continue treating the .md files like a single entity. Containing all data.
Just like word, .doc documents.

@blackhole89
Copy link
Owner

Yeah, but if a big image is included, the resulting markdown file will become basically unusable in any plain text editor (like, you'd have a single line with hundreds of thousands of characters of alphanumeric garbage). #38 also suggests that some other markdown-processing tools don't play nice with them...

@gcoimbra
Copy link
Author

@blackhole89 I think you're right. Most Markdown software support images with web or local links, I think we should change to it too. The way things are now, we can't copy/paste easily the images (we get the base64 encoded image). The only way I think to get the drawings out of notekit is by screen printing them, which is really hard.

I think we can't do it like word with .doc documents without sacrificing simplicity and interoperability with other markdown editors.

I've changed my mind. The only way I see it, is to create a separate subbfolder, like you said.

@blackhole89 blackhole89 added the enhancement New feature or request label Nov 17, 2020
@blackhole89
Copy link
Owner

As of commit 4829902, we now render images given by ![alt text](local path) markdown. Consider this a (very simple) first step to support this.

@sp1ritCS
Copy link
Contributor

sp1ritCS commented Apr 3, 2021

As of commit 4829902, we now render images given by ![alt text](local path) markdown. Consider this a (very simple) first step to support this.

Cool I've been waiting for this. Obviously, this is a very early implementation and major things (like resizing) are missing, but its a first step. Something I've noticed is that it doesn't work with spaces in the file path, that's a bit annoying because gnome shell saves screenshot names with a few spaces.

@blackhole89
Copy link
Owner

resizing

How'd you even handle resizing? You'd have to store the size info in the document, but does Markdown have any standardised way of representing the size of an embedded image?

spaces

Does the Markdown spec allow those? (I took the parser from GtkSourceView's language definition, so whether it's legit is anyone's guess.) I could imagine that the image location is considered a "URL", so in particular has to be URL-encoded (representing spaces as + or %20)... (not that I'd be particularly bothered to deviate from the spec here and support spaces if it does; it seems like the parse would still be unambiguous)

By the way, the commit above might serve as a good piece of (loud scare quotes) "documentation" insofar as it represents a more or less minimal diff to add a new piece of syntax that is rendered to a widget when the cursor is not near it.

@sp1ritCS
Copy link
Contributor

sp1ritCS commented Apr 3, 2021

How'd you even handle resizing?
Well, that's a though one. I came up with these two:

  1. Abusing the alt tag, as (as far as I can tell) NoteKit isn't doing anything with it.
  2. Add some kind of block-comment infront of the image (but afaik notekit is just rendering comments currently)

@blackhole89
Copy link
Owner

Implemented in master now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants