Skip to main content

MkDocs plugin for embedding H5P files in Markdown using h5p-standalone.

Project description

mkdocs-h5p

Embed H5P packages in MkDocs Markdown using tunapanda/h5p-standalone.

The plugin extracts each referenced .h5p file during mkdocs build and injects the standalone H5P player into the generated page by default. It can also render each H5P package through a generated standalone HTML file embedded with an iframe.

Installation

pip install -e .

Enable the plugin in mkdocs.yml:

plugins:
  - search
  - h5p

Markdown Usage

Use the image-like syntax with h5p as the alt text:

![h5p](activities/example.h5p)

You can also use the explicit shortcode form:

{{ h5p("activities/example.h5p") }}

Paths are resolved relative to the Markdown file first, then relative to docs_dir.

Configuration

plugins:
  - h5p:
      h5p_dir: assets/h5p
      player_url: https://cdn.jsdelivr.net/npm/h5p-standalone@3.8.0/dist
      render_mode: inline
      frame: true
      full_screen: true
      export: false
      embed: false
      copyright: false
      player_options:
        icon: true

player_url points to the dist directory for h5p-standalone. By default it uses jsDelivr with version 3.8.0 pinned. For offline sites, download the h5p-standalone dist files into your MkDocs docs folder and set player_url to that local URL.

render_mode can be inline or iframe. The default, inline, adds the H5P div and h5p-standalone scripts to the generated MkDocs page. iframe creates mkdocs-h5p.html inside the extracted package directory under h5p_dir and embeds that file in the generated page.

Notes

Some H5P exports do not include every required library. The standalone player can only run content when the .h5p package includes the libraries it needs.

Publishing to PyPI

Install the packaging tools:

python -m pip install --upgrade build twine

Update pyproject.toml version before publishing:

Build the source distribution and wheel:

python -m build

Test the package on TestPyPI first:

python -m twine upload --repository testpypi dist/*

Then install it from TestPyPI to verify the published artifact:

python -m pip install --index-url https://test.pypi.org/simple/ mkdocs-h5p

Publish to PyPI:

python -m twine upload dist/*

When prompted by twine, use __token__ as the username and a PyPI API token as the password.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_h5p-0.2.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_h5p-0.2.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_h5p-0.2.0.tar.gz.

File metadata

  • Download URL: mkdocs_h5p-0.2.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for mkdocs_h5p-0.2.0.tar.gz
Algorithm Hash digest
SHA256 311925317c2252b44aa4e656c6673dfe5f0dd0c3e59acf79b2ae06e09e60c121
MD5 9b52ae49af14c43db46ce24f473638d3
BLAKE2b-256 8a75a2c05e66ac77ccb51b995ae372ae36c50135e2f085e57ec840607844ac4f

See more details on using hashes here.

File details

Details for the file mkdocs_h5p-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_h5p-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for mkdocs_h5p-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0249f22e893baa641e112f7c9546f6ae668223287d4df52c39a09b819d6537a9
MD5 14b9b06912f30f16ac86b6ec85f915ba
BLAKE2b-256 ccfae862061b2d49bcf404f10a94e58956f780b5ae41ea41bcf4fa7c8b0b6985

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page