Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add Sphinx directive for youtube embeds #3394

Merged
merged 1 commit into from
Apr 28, 2020

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Apr 22, 2020

Add a simple directive .. youtube, implemented as a local sphinx extension, that takes one argument:

  • A YouTube video ID (e.g. aqz-KE-bpKQ)
  • A YouTube URL (e.g. https://www.youtube.com/watch?v=aqz-KE-bpKQ)

When generating HTML docs, any of these will be replaced with an embedded video player showing "Big Buck Bunny":

.. youtube:: aqz-KE-bpKQ

.. youtube:: https://www.youtube.com/watch?v=aqz-KE-bpKQ

.. youtube:: https://youtu.be/aqz-KE-bpKQ

Advanced customization features like start time (?t=45) are currently not supported.

Add a simple directive `.. youtube`, implemented as a local sphinx
extension, that takes one argument — either:
  - A YouTube video ID (e.g. `aqz-KE-bpKQ`)
  - A YouTube URL (e.g. `https://www.youtube.com/watch?v=aqz-KE-bpKQ`)

In either case, when generating HTML docs the directive will be
replaced with an HTML embed of the video content.

Valid forms for the URL include at least:
- https://www.youtube.com/watch?v=YOUTUBE_ID
- https://www.youtube.com/embed/YOUTUBE_ID
- https://youtu.be/YOUTUBE_ID

Features like start time (`?t=45`) are currently not supported.
@ferdnyc ferdnyc added the docs Bad or missing help texts / documentation label Apr 22, 2020
@ferdnyc
Copy link
Contributor Author

ferdnyc commented Apr 24, 2020

Huh. Turns out (not at all surprisingly), someone had already written such a thing. Almost 10 years ago.

sphinx-contrib: youtube extension

It offers more configurability for how the video is embedded (controlling the width/height, etc.) buuuut unlike my version it doesn't allow you to enter a video URL, you have to extract just the ID.

It's also so ancient that it uses HTTP URLs, which wouldn't be acceptable since the rest of the guide is served over HTTPS and we'd end up triggering the browser's insecure-page-element blocking. So, guess we should stick with mine.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Apr 24, 2020

Oh, I'm way behind the times. The updated codebase lives here on GitHub as sphinx-contrib/youtube, and sports all the expected bells and whistles.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Apr 28, 2020

Merging this as it won't affect anything unless we use it. (And if we end up switching over to the version from the official extensions collection, we can just delete this one from the doc/ dir.)

@ferdnyc ferdnyc merged commit bbcb8c0 into OpenShot:develop Apr 28, 2020
@ferdnyc ferdnyc deleted the doc-youtube-directive branch April 28, 2020 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Bad or missing help texts / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant