All Projects → bavovanachte → sphinx-wavedrom

bavovanachte / sphinx-wavedrom

Licence: MIT license
A sphinx extension that allows including wavedrom diagrams by using its text-based representation

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
Makefile
30231 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to sphinx-wavedrom

sphinxcontrib-django
This is a sphinx extension which improves the documentation of Django apps.
Stars: ✭ 37 (+42.31%)
Mutual labels:  sphinx, sphinx-extension
sphinx-codeautolink
Automatic links from code examples to reference documentation
Stars: ✭ 41 (+57.69%)
Mutual labels:  sphinx, sphinx-extension
sphinx-revealjs
Presentation builder for Pythonista
Stars: ✭ 56 (+115.38%)
Mutual labels:  sphinx, sphinx-extension
openapi
OpenAPI (fka Swagger) spec renderer for Sphinx.
Stars: ✭ 78 (+200%)
Mutual labels:  sphinx, sphinx-extension
autodoc pydantic
Seamlessly integrate pydantic models in your Sphinx documentation.
Stars: ✭ 60 (+130.77%)
Mutual labels:  sphinx, sphinx-extension
sphinx-toolbox
Box of handy tools for Sphinx 🧰 📔
Stars: ✭ 55 (+111.54%)
Mutual labels:  sphinx, sphinx-extension
sphinx-hoverxref
Sphinx extension to show tooltips with content embedded when hover a reference.
Stars: ✭ 77 (+196.15%)
Mutual labels:  sphinx, sphinx-extension
sphinx rtd dark mode
Adds a toggleable dark mode to the Read the Docs theme for Sphinx.
Stars: ✭ 29 (+11.54%)
Mutual labels:  sphinx, sphinx-extension
sphinxcontrib-programoutput
Sphinx extension for capturing program output
Stars: ✭ 29 (+11.54%)
Mutual labels:  sphinx, sphinx-extension
sphinxcontrib-hdl-diagrams
Sphinx Extension which generates various types of diagrams from Verilog code.
Stars: ✭ 37 (+42.31%)
Mutual labels:  sphinx, sphinx-extension
emojicodes
An extension to use emoji codes in your Sphinx documentation! 😍
Stars: ✭ 39 (+50%)
Mutual labels:  sphinx, sphinx-extension
matlabdomain
A Sphinx extension for documenting Matlab code
Stars: ✭ 34 (+30.77%)
Mutual labels:  sphinx, sphinx-extension
SMDiagramView
Diagram View for iOS
Stars: ✭ 44 (+69.23%)
Mutual labels:  diagram
books
A collection of online books for data science, computer science and coding!
Stars: ✭ 29 (+11.54%)
Mutual labels:  sphinx
ChatVoicePlayer
An Android library to make the implementation of voice/audio messages' playing easier
Stars: ✭ 157 (+503.85%)
Mutual labels:  waveform
erdiagram
Entity-Relationship diagram code generator library
Stars: ✭ 28 (+7.69%)
Mutual labels:  diagram
typedoc-plugin-mermaid
A plugin for TypeDoc that generates graphs for mermaid.js diagrams by @mermaid annotation.
Stars: ✭ 18 (-30.77%)
Mutual labels:  diagram
ef-db-diagrams
Visualize model created with EntityFramework Core
Stars: ✭ 52 (+100%)
Mutual labels:  diagram
GoJS-projects
Project examples for GoJS
Stars: ✭ 45 (+73.08%)
Mutual labels:  diagram
wavebin
∿ Oscilloscope waveform capture viewer and converter.
Stars: ✭ 31 (+19.23%)
Mutual labels:  waveform

Sphinx wavedrom extension

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

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

https://travis-ci.org/bavovanachte/sphinx-wavedrom.svg?branch=master

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 following decision tree gives an overview of which configurations to make in different use cases:

Decision tree for configuration settings

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.

Depending on the output you're building, the plugin will automatically choose the appropriate image rendering method (HTML defaults to browser rendering, pdf to build-time image generation). You can force the generation of build-time images by adding the following configuration to your conf.py:

wavedrom_html_jsinline = False

This may be interesting in case you are building for various output targets and want to ensure consistent diagrams between all output formats

Build-time image generation through wavedrompy or wavedrom-cli

2 Tools are available for the build-time generation of images:

  • wavedrom-cli: The default builder. This is the tool maintained by the wavedrom team itself. More bloaty than wavedrompy as it requires node.js and npm to install and use, but more likely to render consistent images w.r.t. the browser-rendered version.
  • wavedrompy: A python "clone" of wavedrompy. The goal of the project is to stay as close as possible to the JS implementation, but offer a solution that doesn't require node.js or npm to be installed.

As mentioned, wavedrom-cli is the default builder. If you want to select wavedrompy instead, add render_using_wavedrompy = True to your conf.py:

Wavedrompy is imported as a python module and requires no further configuration. Wavedrom-cli is executed using system calls. The default command is npx wavedrom-cli, but this can be overwritten using the wavedrom_cli configuration parameter in conf.py

Browser-rendered images through 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) hosted on the wavedrom server or your own server
  • Offline mode: the extension uses the javascript file(s) that are saved locally on your drive.

The online mode is the default one. In case you want to use the js files hosted on the wavedrom server, no configuration is needed. However, in case the desired JS files are hosted on a custom server (or on localhost) add the following to conf.py:

  • online_wavedrom_js_url : the url of the server hosting the javascript files. The plugin will look for 2 files:

    • {online_wavedrom_js_url}/skins/default.js
    • {online_wavedrom_js_url}/wavedrom.min.js

Warning: A full URI is needed when configuring. "http://www.google.com" will work but "www.google.com" won't.

If offline mode is desired, the following configuration 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].