obsidian-github-embeds icon indicating copy to clipboard operation
obsidian-github-embeds copied to clipboard

Add Gist Support

Open MrGVSV opened this issue 2 years ago • 4 comments

Also, not a huge thing, but if some day you got the chance to integrate gists into this addon, it would make a perfect single solution.

I am currently using https://github.com/linjunpop/obsidian-gist and it's a great plugin, but having everything wrapped into one would be the icing on the cake. Also sort of irritating that the gist plugin has no support for dark themes. So I have this dark Obsidian theme and then when I scroll to a gist, I get blasted with white.

Not a deal breaker, but just a thought.

Originally posted by @Aetherinox in https://github.com/MrGVSV/obsidian-github-embeds/issues/5#issuecomment-1791869691

MrGVSV avatar Nov 04 '23 05:11 MrGVSV

A side note just in case you need the info.

What makes Github gists so great is that you can view the gist by going to either

  • https://gist.github.com/Aetherinox/e349cd6b200215b1f8d408bf9edc491b
  • https://gist.github.com/Aetherinox/e349cd6b200215b1f8d408bf9edc491b.json

By appending .json on the end, you get a json structure of your gist.

The other Gist addon calls stylesheet and div in the json URL and places that code within Obsidian to show the gist. It's a great idea, but the downside is that he only applied the white theme. And the height of the gist box gets a little wonky / sometimes has large padding at the bottom of the gist box.

nqWdDHn

In the Plugin settings in Obsidian, he provided a CSS Override field, and I've tried every which way to override the CSS to change the background, but nothing seems to work

XjIOj8v

The gist basically shows on your Obsidian note as a giant iframe.

TcInRgX


A good guide if it helps at all: https://codersblock.com/blog/customizing-github-gists/

Aetherinox avatar Nov 04 '23 05:11 Aetherinox

Update

I've started this and have some of the basic setup established. However, it seems there might be a bug with accessing gists using fine-grained PATs with the GraphQL API.

I could use the REST API or the JSON response, but I think I'd prefer to go the GraphQL route. I submitted a ticket with GitHub support so we'll see what they say. If it's not something that's likely to be fixed soon, I may just give into one of the alternatives (probably REST).

MrGVSV avatar Nov 05 '23 01:11 MrGVSV

Nice. It's no rush, but it would definitely be a welcomed feature. I've been trying to tweak the other Gist plugin, and it's not exactly user-friendly and have had to do some really hacky stuff to semi get dark themes in place.

I'm waiting on the developer for the program "OpenGist", who is implementing a feature similar to what GIsts have with json being called and being able to integrate a Opengist snippet.

Aetherinox avatar Nov 09 '23 12:11 Aetherinox

would this feature be added in the next release?

@Aetherinox I have checked your plugin obsidian-gistr it is really nice, it's a bit inconvenient to have two plugins for just github, if you could add the gist feature or the ability to embed private repo files to gitr it would be really great as this project doesn't seem to be in active development.

Thanks

theinhumaneme avatar Jan 04 '25 18:01 theinhumaneme