WordPress.org

Making WordPress.org

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#5582 closed enhancement (wontfix)

Facilitate embedded videos in readme.md for plugin directory page

Reported by: westonruter Owned by:
Milestone: Priority: normal
Component: Plugin Directory Keywords:
Cc:

Description

I discovered recently that WordPress.org supports readme.md in addition to readme.txt. This is great since for a long time I've been using a script to convert the readme.txt into a readme.md for the sake of GitHub, but then excluding it from WordPress.org.

Now I can avoid doing this and just have the one readme.md.

Nevertheless, there is one thing that doesn't port over so well, and that is video. A plugin's readme may include a video via a bare oEmbed URL or shortcode and this is shown on the directory as a video embed. In the script I used, I'd take such a bare URL (for a YouTube video) in the readme.txt to have the poster image linked to the video. This would then have something acceptable for the markdown version on GitHub (which doesn't support video embeds) while also having the actual video embed on the plugin directory page.

What I did in the script is take any instance of the following in the readme.txt:

[youtube https://www.youtube.com/watch?v=s52JNMT59s8]

And convert it into the following in the readme.md:

[![Play video on YouTube](https://i1.ytimg.com/vi/s52JNMT59s8/hqdefault.jpg)](https://www.youtube.com/watch?v=s52JNMT59s8)

But now that I can use the readme.md as the source of truth, I'd like the opposite to be supported.

My proposal: Extend WordPressdotorg\Plugin_Directory\Markdown::transform() to support matching any instance of linked poster images (to YouTube) and automatically transform them to bare URLs for oEmbed to kick in.

So given a readme.md that contained:

[![Play video on YouTube](https://i1.ytimg.com/vi/s52JNMT59s8/hqdefault.jpg)](https://www.youtube.com/watch?v=s52JNMT59s8)

This would get transformed into:

https://www.youtube.com/watch?v=s52JNMT59s8

The same would go for other oEmbed providers in addition to YouTube.

The benefit here is that the readme.md on GitHub would not need to have an unsightly bare URL and could instead have a linked video poster image. See the AMP plugin's README.md on GitHub for example: https://github.com/ampproject/amp-wp/blob/develop/README.md#description

Change History (3)

#1 @Otto42
3 months ago

No, readme.md is supported instead of readme.txt, but the formatting for the two remains identical.

You should still use a readme.txt for wordpress.org, and readme.md for GitHub, because of the differences in the formatting specifications.

#2 @westonruter
3 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

OK, I've opted to generate the readme.txt from the README.md at build time, doing various transformations as needed for formatting.

https://github.com/GoogleChromeLabs/pwa-wp/pull/400
https://github.com/ampproject/amp-wp/pull/5815

#3 @Otto42
3 months ago

Yeah, right now, limited markdown is supported (in either txt or md), but it's not quite the same as GitHub's markdown all the time. If at some point we decide to separate the two and use different types of markups for them, then this would make more sense then. But that's a bit more of a comprehensive thing to do.

Note: See TracTickets for help on using tickets.