Jump to content

Would be nice if GitLab snippets were embedded automatically

pythonmegapixel

GitLab (the main competitor to GitHub) as a feature called "snippets" which allows small sections of code to be shown in a nice format on one page.

They also have a very nice embedded widget thingy to put these on other sites, so I think it would be nice if someone posted a link to a snippet, if that snippet was automatically embedded, just like Twitter and YouTube.

 

Generating embed code for them is pretty simple - all it requires is that you load the snippet URL as JavaScript with the .js extension on the end.

 

So, for example, if I have my snippet https://gitlab.com/-/snippets/2095997

then to embed it, it's

<script src="https://gitlab.com/-/snippets/2095997.js" />

 

____________________________________________________________________________________________________________________________________

 

 

____________________________________________________________________________________________________________________________________

pythonmegapixel

into tech, public transport and architecture // amateur programmer // youtuber // beginner photographer

Thanks for reading all this by the way!

By the way, my desktop is a docked laptop. Get over it, No seriously, I have an exterrnal monitor, keyboard, mouse, headset, ethernet and cooling fans all connected. Using it feels no different to a desktop, it works for several hours if the power goes out, and disconnecting just a few cables gives me something I can take on the go. There's enough power for all games I play and it even copes with basic (and some not-so-basic) video editing. Give it a go - you might just love it.

Link to comment
Share on other sites

Link to post
Share on other sites

The forum only has first class support for embeds that use oEmbed, a standard API for getting the embedded content for a given URL. GitLab doesn't support oEmbed, so it wouldn't be straight forward to add, and given that gitlab is significantly less popular than github, and links to github gists are pretty rare, I don't think it makes sense to try to work around that.

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

26 minutes ago, colonel_mortis said:

The forum only has first class support for embeds that use oEmbed, a standard API for getting the embedded content for a given URL. GitLab doesn't support oEmbed, so it wouldn't be straight forward to add, and given that gitlab is significantly less popular than github, and links to github gists are pretty rare, I don't think it makes sense to try to work around that.

I'd forgotten about Gists, otherwise I'd have mentioned them too.

 

Do Gists autoembed? Because if so, I might switch to using them. I'm really not a fan of how this forum handles code blocks, and I like having the integrations with a Git provider.

____________________________________________________________________________________________________________________________________

 

 

____________________________________________________________________________________________________________________________________

pythonmegapixel

into tech, public transport and architecture // amateur programmer // youtuber // beginner photographer

Thanks for reading all this by the way!

By the way, my desktop is a docked laptop. Get over it, No seriously, I have an exterrnal monitor, keyboard, mouse, headset, ethernet and cooling fans all connected. Using it feels no different to a desktop, it works for several hours if the power goes out, and disconnecting just a few cables gives me something I can take on the go. There's enough power for all games I play and it even copes with basic (and some not-so-basic) video editing. Give it a go - you might just love it.

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, pythonmegapixel said:

I'd forgotten about Gists, otherwise I'd have mentioned them too.

 

Do Gists autoembed? Because if so, I might switch to using them. I'm really not a fan of how this forum handles code blocks, and I like having the integrations with a Git provider.

No, they don't support oembed either.

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×