[wp-meta] [Making WordPress.org] #5582: Facilitate embedded videos in readme.md for plugin directory page
Making WordPress.org
noreply at wordpress.org
Mon Jan 25 04:50:48 UTC 2021
#5582: Facilitate embedded videos in readme.md for plugin directory page
------------------------------+--------------------
Reporter: westonruter | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Plugin Directory | Keywords:
------------------------------+--------------------
I [https://johnblackbourn.com/readme-md-plugin-on-wordpress-org/
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
[https://github.com/xwp/wp-dev-lib/blob/master/scripts/generate-markdown-
readme 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
[https://make.wordpress.org/core/2010/02/20/plugins-can-now-include-
videos-in-their-readme-txt-files/ 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 [https://github.com/xwp/wp-dev-
lib/blob/a62ccca94f9995f294e12d500c45856adff81e34/scripts/class-wordpress-
readme-parser.php#L96-L100 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
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/5582>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list