Skip to main content

mkdocs-wavesurfer

This is a plugin for mkdocs that adds a waveform display for <audio> elements using wavesurfer.js.

This plugin only works when mkdocs-audiotag is also installed and enabled.

Quick start

Install the plugin

pip install mkdocs-wavesurfer

Enable the plugin in mkdocs.yml

plugins:
  - mkdocs-audiotag # required
  - mkdocs-wavesurfer

Embed an audio file in markdown source

As described on the mkdocs-audiotag readme.

![audio/ogg](my-audio-file.ogg)

The waveform will be shown below the audio element's controls.

Configuration

You can tweak how wavesurfer.js displays the waveform using a range of configuration options. See the wavesurfer.js documentation and the very nice visual examples for a full description.

Add your options under the mkdocs-wavesurfer plugin in your mkdocs.yml.

plugins:
  - mkdocs-audiotag
  - mkdocs-wavesurfer:
      height: 200
      wave_color: "#0fcb2bff"
      progress_color: rgb(0, 100, 0)
      cursor_color: red
      cursor_width: 10
      bar_width: 5
      bar_gap: 2

Waveform canvas generated with the configuration shown above

Note:

  • Defaults: You only need to specify the options you want to override, as others will use default values.
  • Colors: Can be specified as in CSS using hex values, rgb(), or color names, as shown in the example above.
  • Case: We use snake case in mkdocs.yml for consistency, as opposed to the wavesurfer.js docs which use javascript and camel case.

Use with mkdocs-material

The plugin can adapt to the color set by mkdocs-material for a visually coherent style.

plugins:
  - mkdocs-audiotag
  - mkdocs-wavesurfer:
      use_mkdocs-material_color: true

When this is enabled, the options wave_color and progress_color are overwritten, and the plugin will log a warning if they are present in mkdocs.yml.

Autopopulated options

Please note that the following wavesurfer options are populated automatically by the plugin and cannot be specified in the config:

  • media_controls
  • media
  • url
  • container

If you would like to remove the browser's default media controls, you can do so by configuring mkdocs-audiotag:

plugins:
  - mkdocs-audiotag:
      controls: false
  - mkdocs-wavesurfer

Default config values

Below are the default configuration values:

plugins:
  - mkdocs-wavesurfer:
      height: 128
      width: "100%"
      split_channels: false
      normalize: false
      wave_color: "#ff4e00"
      progress_color: "#dd5e98"
      cursor_color: "#ddd5e9"
      cursor_width: 2
      bar_width: null
      bar_gap: null
      bar_radius: null
      bar_height: null
      bar_align: ""
      min_px_per_sec: 1
      fill_parent: true
      autoplay: false
      interact: true
      drag_to_seek: false
      hide_scrollbar: false
      audio_rate: 1.0
      auto_scroll: true
      auto_center: true
      sample_rate: 8000
      use_mkdocs_material_color: false

License

This plugin is licensed under the MIT license.

Beware that wavesurfer.js is licensed under the BSD-3-Clause license.

Metadata

Release files for mkdocs-wavesurfer 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkdocs-wavesurfer 0.1.1
File Size Uploaded Provenance
mkdocs_wavesurfer-0.1.1.tar.gz 5.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-wavesurfer 0.1.1
File Interpreter ABI Platform
mkdocs_wavesurfer-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / mkdocs_wavesurfer-0.1.1.tar.gz

Download URL mkdocs_wavesurfer-0.1.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2b9aaaeffbad8da4c66f892b2d0a4e43df310116aaace4a38191dc50152f905f
BLAKE2b-256 checksum
How to use checksums
5181ce3d6907cf69d42830f71023108699644724479ede449cfaafcc0ec89be4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / mkdocs_wavesurfer-0.1.1-py3-none-any.whl

Download URL mkdocs_wavesurfer-0.1.1-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67c77d4a97c968bd328aa4639b664fc81beafdb27eafe7717053c8fcc547ad4b
BLAKE2b-256 checksum
How to use checksums
e36d24e9e2c02c4d9f32986eb3a4a3c4603b11a67dfb72fc1db9581d52484a6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for mkdocs-wavesurfer 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page