WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#41206 new enhancement

Add embed handler for GitHub gists

Reported by: swissspidy Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Embeds Keywords: has-patch
Focuses: Cc:
PR Number:

Description

Gutenberg currently explores adding adding a new block for embedding gists from GitHub (gist.github.com). See: https://github.com/WordPress/gutenberg/issues/1567.

Although Gist supports oEmbed, it only returns raw HTML with code excerpts. There's a superior JS method for embeds, which is also shown when viewing a Gist in the browser. Jetpack supports this method as well.

If Gutenberg wants to add a new block for gists, it should definitely be supported natively by core.

See attached patch as a PoC

Attachments (1)

41206.diff (1.8 KB) - added by swissspidy 2 years ago.

Download all attachments as: .zip

Change History (8)

@swissspidy
2 years ago

#1 @tfrommen
2 years ago

I'm +1 for this, and actually wondered just yesterday why it isn't supported by Core so far and when it might be. :)

However, I don't understand the .json.js thing. Why create URLs for JSON files and then replace the ending anyway? Is there some edge case that I just don't see, or why can't we create URLs for .js files in the first place?

#2 @swissspidy
2 years ago

Probably just a leftover from when I copiedsome code from Jetpack for the patch.

#3 @westonruter
2 years ago

Yeah, also the str_replace( 'json', 'js', $url ) bit seems a bit brittle. Like I should think it should target the specific query param or path segment to replace.

#4 @peterwilsoncc
2 years ago

Going through the checklist for the sake of completeness.

Is the service is popular enough for core developers to have heard of it before? Is it “mainstream?”
Yes, it is mainstream. Core developers have heard of it.

If similar services are already supported, how does this service compare in terms of size, features, and backing?
No similar service supported.

Does this service have a large following on Twitter, Facebook, or other social media? Is its Twitter account verified?
Verified Twitter account with 1.5 million followers.
Verified Facebook account with 110K likes.

Is its oEmbed endpoint clearly established and properly documented? (Sometimes, they are just a developer’s pet project that may not be supported.)
No.

Does the oEmbed endpoint work with WordPress’ oEmbed auto-discovery? If not, could it be made to work with additional HTML tags or attributes being whitelisted?
No and no.

Were Github to add oembed headers, it could be made to work with the the addition of table HTML tags to the whitelisted elements. I don't have any desire to whitelist table elements.

Does the service make an effort to build relationships with developers, such as through robust APIs?
Yes

How old is the service?
9 years old.

Does it have a well-established Wikipedia article? (Seriously.)
Sure does.

Has anyone written a WordPress plugin that leverages the service in some way, whether adding it as an oEmbed provider, creating a shortcode, or leveraging other APIs of the service? Do these plugins have any noticeable adoption or traction that would indicate usage and demand?
Numerous plugins with a variety of install quantities.

Is the provider frequently proposed?
Not really, although support is in Jetpack so it suggests a strong demand.

#5 follow-up: @peterwilsoncc
2 years ago

@swissspidy,

The low quality documentation and lack of oembed header bother me a bit. It suggests hobby project without wide support.

Have you contacted them with a feature request to add the headers? I'm happy to do so and refer them to this ticket if you haven't.

#6 @marsjaninzmarsa
2 years ago

@peterwilsoncc,

The low quality documentation and lack of oembed header bother me a bit. It suggests hobby project without wide support.

GitHub

hobby project

Lel.

Have you contacted them with a feature request to add the headers? I'm happy to do so and refer them to this ticket if you haven't.

I've did:

From: Kuba Niewiarowski <marsjaninzmarsa@…>
To: support@…
Topic: oEmbed provider for Gist, please?

It could be helpful for WordPress folks:
https://github.com/WordPress/gutenberg/issues/1567

From: Nick Cannariato (GitHub Staff) <support@…>
To: Kuba Niewiarowski <marsjaninzmarsa@…>


Hi Kuba,

Thanks for writing in and pointing us to that issue. I can't make any promises, but I'll pass this on to the team for their consideration.

#7 in reply to: ↑ 5 @jorbin
2 years ago

Replying to peterwilsoncc:

@swissspidy,

The low quality documentation and lack of oembed header bother me a bit. It suggests hobby project without wide support.

Have you contacted them with a feature request to add the headers? I'm happy to do so and refer them to this ticket if you haven't.

@benbalter may be able to help identify people on the github side that could help here.

Note: See TracTickets for help on using tickets.