subconsciousnetwork / subtext

Markup for note taking
Apache License 2.0
271 stars 20 forks source link

images #57

Open justinabrahms opened 10 months ago

justinabrahms commented 10 months ago

I'd like to store images in my notes so that I can capture great visualizations that communicate ideas well. Here is one such note.

image

This may have the same syntax as #56.

It's worth noting that inline images may be a thing (think: emojis before we got support for them), but isn't exactly what I'm referring to here.

bmann commented 10 months ago

TiddlyWiki has really struggled (and continues to) without first class image support.

Supporting https://example.com/path/to/img.jpg to display inline could be a thing.

And also some form of “attaching” an image to a note, which should get synced alongside it.

And then you need “local” transclusion like file://img.jpg? This is fuzzy. Or maybe you just do unique slugs with an image extension — so /img.jpg “just works” — which means you can’t have duplicate image file names but maybe that’s good?

third item — re-usable image like “Name of an Image” (that’s the Note title) which contains file://img.jpg

so /name-of-an-image would transclude the image.

(or /name-of-an-image.jpg)

aside from jpg and other image formats, supporting PDFs would be good in the same way

polyrainbow commented 10 months ago

With regards to image URLs, I think the spec is clear:

Rendering links

For all kinds of links, including bare URLs, bracket URLs, and slashlinks, the client MUST render some kind of user-interactable link to the referenced document. The client MAY choose what form this link takes.

For file types it understands, the client MAY render all or part of the linked document in-place (e.g. transclude). For example:

  • A linked image file (.png, .jpg, .gif, etc) MAY be rendered in-place by the client and sized to fit its context.

When referenced via slashlink or wikilink however, I think the slug syntax should be defined by the client and not included in the Subtext spec, as it depends very much on how the implementing system saves data.

E.g. in NENO, we're using file extensions in slashlinks (as in /image.jpg), but only because the bare files are stored on disk without any index. We need the file extension to identify the image.

With Noosphere however, all memos (including images) have slugs with their file extensions removed. Instead, the content type is saved in a memo header. So we can just do /my-image or @someone-elses/image. Same goes for other media types.

That's why I think the sentence "A linked image file (.png, .jpg, .gif, etc) ..." could be refined so that it is not given that the linked image actually is a file with an extension, but could also be a bitstream with a MIME type.