Skip to main content

Support for WaveDrom in Python Markdown

Project description

Support for WaveDrom in Python Markdown

This extension adds support for WaveDrom to Python Markdown.

Installation

pip install markdown-wavedrom

This extension parses Markdown and replaces matching sections with HTML script elements. To enable WaveDrom rendering, you must ensure that the proper JavaScript code is loaded into your HTML page. See the WaveDrom documentation for details.

Example

# My Markdown Documentation

wavedrom (
    { signal: [{ name: "Alfa", wave: "01.zx=ud.23.456789" }] }
)

MkDocs Integration

The following minimal config is required to get markdown-wavedrom to work in MkDocs.

markdown_extensions:
  - markdown_wavedrom

extra_javascript:
  - https://cdnjs.cloudflare.com/ajax/libs/wavedrom/2.6.8/wavedrom.min.js
  - https://cdnjs.cloudflare.com/ajax/libs/wavedrom/2.6.8/skins/default.js
  - js/wavedrom_loader.js

Where docs/js/wavedrom_loader.js has the following content:

window.addEventListener("load", function () {
  WaveDrom.ProcessAll();
});

You can of cause also host the WaveDrom JavaScript files locally with your documentation.

For a complete example with MkDocs, see the markdown-wavedrom-mkdocs-example GitHub page.

Development

Feel free to open an issue or a PR if there is something that can be improved.

Releases on PyPI are created automatically through python-semantic-release. Therefore, this project uses Angular commit message style for commits.

Testing

$ pip install -r dev-requirements.txt
$ tox

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

markdown-wavedrom-1.0.0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

markdown_wavedrom-1.0.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

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