A Sphinx extension for embedding WaveDrom diagrams
Project description
sphinxcontrib-yowasp-wavedrom
This Sphinx extension allows embedding WaveDrom waveform, bitfield, and circuit diagrams into Sphinx documents.
This extension uses the YoWASP WaveDrom package to ensure that diagrams are rendered exactly the same as in the WaveDrom editor, without having to follow a decision tree for configuration, without requiring any additional tools to be installed on the system used to build documentation, without requiring any native dependencies to be installed on that system, without requiring JavaScript for browsing documentation, and without slowing down the Sphinx build process. It also reports syntax and semantic errors with accurate source locations.
WaveJSON diagram descriptions are always converted into SVG files; only the HTML builder is supported at the moment. Sphinx themes with color schemes toggles, like Furo, are supported by default, but may require custom CSS for integration.
Usage
This extension provides only one directive, wavedrom
. Its argument is the base name, without extension, of the generated image file (in <output directory>/_images/
; which must be unique in the entire document tree), and its contents is the raw WaveJSON file that can be copied to or from the editor. For example:
.. wavedrom:: clk_and_data
{"signal": [
{"name": "clk", "wave": "n..."},
{"name": "data", "wave": "01.0"}
]}
Additional examples are available in the test suite, as well as the corresponding rendered output.
Configuration
The extension recognizes these configuration variables in conf.py
:
# Default skin for waveforms. If `json["config"]["skin"]` is not set in the directive,
# it defaults to the value of this variable. Does not affect bit fields or circuits.
yowasp_wavedrom_skin = "default"
License
This project is distributed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for sphinxcontrib_yowasp_wavedrom-1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46253fd0ac2bfc5e7c022030bd5620c9680e786ed0a405f25a2c9e0353bb6023 |
|
MD5 | 8538675f5ad9ae9485e2946a95bca628 |
|
BLAKE2b-256 | 44a2301ec8d42e4c54ee9725d4821b47739364669d2a03b212215261635e8b60 |