Sphinx YouTube Extension

1.5.0 · active · verified Thu Apr 16

sphinxcontrib-youtube is a Sphinx extension that enables embedding YouTube, Vimeo, and PeerTube videos directly into reStructuredText or MyST documentation. It is currently at version 1.5.0 and is actively maintained with several releases per year addressing compatibility with Sphinx, adding new features, and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

To enable `sphinxcontrib-youtube`, add `'sphinxcontrib.youtube'` to the `extensions` list in your Sphinx project's `conf.py` file. Then, use the `.. youtube::` directive in your reStructuredText or MyST files, providing the full URL to the video.

# conf.py

import os
import sys

project = 'My Sphinx Project'
copyright = '2023, Your Name'

extensions = [
    'sphinxcontrib.youtube',
]

# html_theme = 'alabaster' # Or any other Sphinx theme

# In your .rst or .md file (e.g., index.rst):
#
# .. youtube:: https://www.youtube.com/watch?v=dQw4w9WgXcQ
#    :width: 560
#    :height: 315
#    :align: center
#    :alt: Example YouTube Video
#
# For Vimeo or PeerTube, use their respective full URLs.
# .. youtube:: https://vimeo.com/209761509
#    :width: 560
#    :height: 315

view raw JSON →