Work as Sphinx extension

You can embed HTML content from oEmbed API.

Set up

extensions = [
    # After extensions
    "oembedpy.ext.sphinx",
]

Usage

Write oembed directive into your document.

.. oembed:: CONTENT-URL

When it build, embed iframe content into your HTML.

Configuration

oembed_use_workspace
Type:

bool

Default:

False

Switch to toggle using simple client and workspace.

If it is set True`, extension uses Workspace object as client.

Note

See Workspace for more information.

Spec of directive

.. oembed::
:maxwidth: (int)

Max width for embed content. This value is used by API request.

:maxheight: (int)

Max height for embed content. This value is used by API request.

Example

Simple using

.. oembed:: https://www.youtube.com/watch?v=Oyh8nuaLASA

With options

.. oembed:: https://www.youtube.com/watch?v=Oyh8nuaLASA
   :maxwidth: 640
   :maxheight: 640