obsidian-share-as-gist
obsidian-share-as-gist copied to clipboard
Linked images...
Hello, Tim.
First, thank you for this incredibly useful plugin. I find myself using it to draft feedback for students more and more. The ability to do that in Obsidian and push it to github is really terrific.
I wonder if it could support embedded images? I typically use the ![[image.png]]
embedding style but am happy to use a different method.
You can find an example post here, where I've resorted to pasting the image in a comment as a workaround: https://gist.github.com/4d06d592f0b0ae1771c0012de3562d8d
Regardless, many thanks again.
Dan
Thanks for reaching out! 👋🏻 Are the images coming from your local machine?
Yes, local images. Given how easy it is to drag and drop images into the GH interface, with links auto-created, I hoped that the API you are using would facilitate the same.
Unfortunately, I don't believe that there is a way to do this in the API. We would have to host the images somewhere else externally.
That’s a shame. Thank you for considering it. I wonder if something like the approach used in this recently released plugin would work? It uses a “data url” to include images in html without generating an external link.
https://github.com/mvdkwast/obsidian-copy-as-html
Unfortunately, I don't believe that there is a way to do this in the API. We would have to host the images somewhere else externally.
@timrogers Why not simply upload the embedded images as files on the Gist?
Unfortunately, I don't believe that there is a way to do this in the API. We would have to host the images somewhere else externally.
@timrogers Why not simply upload the embedded images as files on the Gist?
I haven't checked in detail, but is that supporter? Once you've uploaded them, can you embed them?
I haven't checked in detail, but is that supporter? Once you've uploaded them, can you embed them?
Using git add/commit/push
it works. See this Gist for an example: https://gist.github.com/devnoname120/32d3a6a2b93bdbe47652038739b815b0
You could use https://github.com/isomorphic-git/isomorphic-git to run Git commands. This is the approach taken by obsidian-git
Unfortunately uploading binary files directly through the Git REST API isn't supported. The closest I got is:
jq --raw-input --slurp '{"description":"Example of a gist","public":false,"files":{"image.png":{"content": .}}}' image.png | curl -L \
-X POST \
-H "Authorization: Bearer [REDACTED]"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/gists \
-d @-
However the uploaded image.png
is broken: all the non-valid UTF-8 characters are removed.
I haven't checked in detail, but is that supporter? Once you've uploaded them, can you embed them?
Using
git add/commit/push
it works. See this Gist for an example: https://gist.github.com/devnoname120/32d3a6a2b93bdbe47652038739b815b0You could use https://github.com/isomorphic-git/isomorphic-git to run Git commands. This is the approach taken by obsidian-git
Can you share a detailed guide? The images links used in obsidian [[aa.png]] are in some way automatically modified or you have to edit it manually?