Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

A sphinx extension that allows including wavedrom diagrams by using its text-based representation

Wavedrom online editor and tutorial: http://wavedrom.com/

https://travis-ci.org/bavovanachte/sphinx-wavedrom.svg?branch=master https://badge.fury.io/py/sphinxcontrib-wavedrom.svg

Installation

The wavedrom extension can be installed using pip:

pip install sphinxcontrib-wavedrom

and by adding ‘sphinxcontrib.wavedrom’ to the extensions list in your conf.py file.

Directives

The extension is useable in the form of an extra wavedrom directive, as shown below.

.. wavedrom::

        { "signal": [
                { "name": "clk",  "wave": "P......" },
                { "name": "bus",  "wave": "x.==.=x", "data": ["head", "body", "tail", "data"] },
                { "name": "wire", "wave": "0.1..0." }
        ]}

Alternatively, it can read the json from a file:

.. wavedrom:: mywave.json

When configured to generate images (see Configuration) the directive will generate an image and include it into the input. It allows for the same configuration as the image directive:

.. wavedrom:: mywave.json
:height: 100px
:width: 200 px
:scale: 50 %
:alt: alternate text
:align: right

The image can be turned into a figure by adding a caption:

.. wavedrom:: mywave.json
    :caption: My wave figure

The extension can be configured (see Configuration) to not generate an image out of the diagram description itself, but to surround it with some html and js tags in the final html document that allow the images to be rendered by the browser. This is the currently the default for HTML output.

Configuration

The extension can be configured to either directly output images or by emitting the javascript to live-render the wavedrom code, which obviously only works for HTML output. All other outputs (most notably latexpdf) embed a generated image in any case, but this is only supported when using Python 3.

For HTML output the configuration item wavedrom_html_jsinline (default: True) can toggled to generate images instead of inline javascript code. You must add the following line to your conf.py:

wavedrom_html_jsinline = False

or overwrite the setting on the command line, for example:

sphinx-build -b html -D wavedrom_html_jsinline=0 sources build/html

HTML: Inline Javascript

When HTML building is configured to inline the javascript (default), the extension can work in 2 modes:

  • Online mode: the extension links to the javascript file(s) provided by the wavedrom server

  • Offline mode: the extension uses the javascript file(s) that are saved locally on your drive.

The online mode is the default one. This requires no configuration in conf.py

If offline mode is desired, the following parameters need to be provided:

The paths given for these configurations need to be relative to the configuration directory (the directory that contains conf.py)

Examples

In the example folder, you can find a couple of examples (taken from the wavedrom tutorial), illustration the use of the extension.

Release files for sphinxcontrib-wavedrom 2.1.2a1

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

Source distribution (sdist)

Source distribution for sphinxcontrib-wavedrom 2.1.2a1
File Size Uploaded
sphinxcontrib-wavedrom-2.1.2a1.tar.gz 37.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinxcontrib-wavedrom 2.1.2a1
File Interpreter ABI Platform
sphinxcontrib_wavedrom-2.1.2a1-py3-none-any.whl Python 3 none any Details

Total release size:45.6 kB

Release files / sphinxcontrib-wavedrom-2.1.2a1.tar.gz

Download URL sphinxcontrib-wavedrom-2.1.2a1.tar.gz
Size 37.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7e827250708946f1bf63266ac649c621a43574c4572c5ce42829210dea7a4eac
BLAKE2b-256 checksum
How to use checksums
35eaff68c198a9bed28649ae9abc2e8d2538c5dd1c22e69cecba29a413ba0db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / sphinxcontrib_wavedrom-2.1.2a1-py3-none-any.whl

Download URL sphinxcontrib_wavedrom-2.1.2a1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee2c0adce62690c322b08b2bde05a41a0ea7c2fea7707a61544cd82e7c18887c
BLAKE2b-256 checksum
How to use checksums
a199a01b83fac82dd047ca0dfbb331602fb3c05c1b7c1373dca2b5c253e91af4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
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