pax_global_header00006660000000000000000000000064144346566460014534gustar00rootroot0000000000000052 comment=abf6c2d2d8aff52182c99322c807fda1df4d5e7a sphinxcontrib-mermaid-0.9.2/000077500000000000000000000000001443465664600160525ustar00rootroot00000000000000sphinxcontrib-mermaid-0.9.2/.github/000077500000000000000000000000001443465664600174125ustar00rootroot00000000000000sphinxcontrib-mermaid-0.9.2/.github/workflows/000077500000000000000000000000001443465664600214475ustar00rootroot00000000000000sphinxcontrib-mermaid-0.9.2/.github/workflows/release.yml000066400000000000000000000011141443465664600236070ustar00rootroot00000000000000name: Publish Python 🐍 distributions 📦 to PyPI on: push: tags: - "*" jobs: pypi-publish: name: upload release to PyPI runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') permissions: id-token: write steps: - name: Checkout uses: actions/checkout@v3 - name: install build run: python -m pip install --upgrade build - name: build run: python -m build - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1sphinxcontrib-mermaid-0.9.2/.github/workflows/test.yml000066400000000000000000000015141443465664600231520ustar00rootroot00000000000000name: Test on: [push, pull_request, workflow_dispatch] env: FORCE_COLOR: 1 jobs: test: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: python-version: ["pypy3.8", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] os: [windows-latest, macos-latest, ubuntu-latest] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} cache: pip cache-dependency-path: docs/requirements.txt - name: Install dependencies run: | python -m pip install -r docs/requirements.txt python -m pip install -U pytest python -m pip install -e . - name: Test run: | pytest sphinxcontrib-mermaid-0.9.2/.gitignore000066400000000000000000000021351443465664600200430ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python env/ build/ _build/ _static/ _templates/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *,cover .hypothesis/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # IPython Notebook .ipynb_checkpoints # pyenv .python-version # celery beat schedule file celerybeat-schedule # dotenv .env # virtualenv venv/ ENV/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # IDEA project settings .idea sphinxcontrib-mermaid-0.9.2/.readthedocs.yaml000066400000000000000000000012141443465664600212770ustar00rootroot00000000000000# .readthedocs.yaml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 # Set the version of Python and other tools you might need build: os: ubuntu-20.04 tools: python: "3.8" nodejs: "16" jobs: post_install: - npm install -g @mermaid-js/mermaid-cli # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py # If using Sphinx, optionally build your docs in additional formats such as PDF formats: - epub - pdf python: install: - requirements: docs/requirements.txt - method: pip path: .sphinxcontrib-mermaid-0.9.2/CHANGELOG.rst000066400000000000000000000061341443465664600200770ustar00rootroot00000000000000Changelog --------- 0.9.2 (May 28, 2023) +++++++++++++++++++++ - Implemented zoom on diagrams functionality. Contributed by `Daniel Althviz Moré `_ - Fix a bug on empty diagram generations. Contributed by `Kevin Deldycke `_. - Upgrade default to Mermaid 10.2.0. - Implement automatic releases from Github Actions when a tag is pushed See full `set of changes `_. 0.8.1 (Feb 25, 2023) +++++++++++++++++++++ - Default to Mermaid 9.4.0 as 10.0 introduced incompatible changes. See `the discussion `_. 0.8 (Feb 9, 2023) +++++++++++++++++++++ - Moved CI to Github Actions - Make the class diagram reproducible - Allow the user to change the JS priority - Drop support for Python 3.6 - Black formatting See `full set of changes `_. 0.7.1 (July 17, 2021) +++++++++++++++++++++ - Update docs and tests for markdown support 0.7 (May 31, 2021) ++++++++++++++++++++++++++ - Add compatibility with Sphinx 4.0 - `mermaid_init_js` is now included in an standard way. - Documented how to use in Markdown documents 0.6.3 (February 21, 2021) ++++++++++++++++++++++++++ - Make it compatible with recent Sphinx versions - Add basic (real) tests (So I stop breaking it!) 0.6.2 (February 18, 2021) ++++++++++++++++++++++++++ - fix regression - setup travis 0.6.1 (February 8, 2021) ++++++++++++++++++++++++++ - Fix a problem when called mermaid-cli - Fix typos on documentation - Improve internal code formatting (via black) 0.6.0 (January 31, 2021) ++++++++++++++++++++++++++ - Drop support for Python version older than 3.6. - Allow to include javascript lib locally - Initialization code is now customizable - The default version included from the CDN is always the latest available. 0.5.0 (September 24, 2020) ++++++++++++++++++++++++++ - Added mermaid_cmd_shell. Useful for Windows user. - Reimplement inheritance diagrams. - Fix UnicodeEncodeError on Python 2 0.4.0 (April 9, 2020) +++++++++++++++++++++ - Added `mermaid_params` - Added config file option - Improved latex integration - Added the `pdfcrop` functionality - Mermaid version is configurable - Several cleanups in the code 0.3.1 (Nov 22, 2017) ++++++++++++++++++++ - Support the new Mermaid CLI by `Bastian Luettig `_ 0.3 (Oct 4, 2017) +++++++++++++++++++ - several improves and bugfixes contributed by `Alberto Berti `_ 0.2.1 (Jun 4, 2017) +++++++++++++++++++ - Workaround for opacity issue with rtd's theme (thanks to `Anton Koldaev `_) 0.2 (Jun 4, 2017) +++++++++++++++++ - Python 3 support fix (thanks to `Shakeeb Alireza `_) - In-browser diagram generation - Autoclasstree directive. (Thanks to `Zulko `_) 0.1.1 (Jun 4, 2017) +++++++++++++++++++ - Better usage instructions - Bugfix 0.1 (Jul 18, 2016) ++++++++++++++++++ - first public version sphinxcontrib-mermaid-0.9.2/LICENSE.rst000066400000000000000000000025321443465664600176700ustar00rootroot00000000000000| sphinxcontrib-mermaid is a Sphinx extension for Mermaid Diagrams | Copyright (c) 2016 by Martín Gaitán | All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. sphinxcontrib-mermaid-0.9.2/MANIFEST.in000066400000000000000000000001451443465664600176100ustar00rootroot00000000000000include README.rst include CHANGELOG.rst include LICENSE.rst global-exclude *.pyc exclude .gitignore sphinxcontrib-mermaid-0.9.2/README.rst000066400000000000000000000213221443465664600175410ustar00rootroot00000000000000.. image:: https://github.com/mgaitan/sphinxcontrib-mermaid/actions/workflows/test.yml/badge.svg :target: https://github.com/mgaitan/sphinxcontrib-mermaid/actions/workflows/test.yml .. image:: https://img.shields.io/pypi/v/sphinxcontrib-mermaid :target: https://pypi.org/project/sphinxcontrib-mermaid/ .. image:: https://img.shields.io/pypi/dm/shbin :target: https://libraries.io/pypi/sphinxcontrib-mermaid/ This extension allows you to embed `Mermaid `_ graphs in your documents, including general flowcharts, sequence diagrams, gantt diagrams and more. It adds a directive to embed mermaid markup. For example:: .. mermaid:: sequenceDiagram participant Alice participant Bob Alice->John: Hello John, how are you? loop Healthcheck John->John: Fight against hypochondria end Note right of John: Rational thoughts
prevail... John-->Alice: Great! John->Bob: How about you? Bob-->John: Jolly good! By default, the HTML builder will simply render this as a ``div`` tag with ``class="mermaid"``, injecting the external javascript, css and initialization code to make mermaid works. For other builders (or if ``mermaid_output_format`` config variable is set differently), the extension will use `mermaid-cli `_ to render as to a PNG or SVG image, and then used in the proper code. .. mermaid:: sequenceDiagram participant Alice participant Bob Alice->John: Hello John, how are you? loop Healthcheck John->John: Fight against hypochondria end Note right of John: Rational thoughts
prevail... John-->Alice: Great! John->Bob: How about you? Bob-->John: Jolly good! You can also embed external mermaid files, by giving the file name as an argument to the directive and no additional content:: .. mermaid:: path/to/mermaid-gantt-code.mmd As for all file references in Sphinx, if the filename is not absolute, it is taken as relative to the source directory. In addition, you can use mermaid to automatically generate a diagram to show the class inheritance using the directive ``autoclasstree``. It accepts one or more fully qualified names to a class or a module. In the case of a module, all the class found will be included. Of course, these objects need to be importable to make its diagram. If an optional attribute ``:full:`` is given, it will show the complete hierarchy of each class. The option ``:namespace: `` limits to the base classes that belongs to this namespace. Meanwhile, the flag ``:strict:`` only process the classes that are strictly defined in the given module (ignoring classes imported from other modules). For example:: .. autoclasstree:: sphinx.util.SphinxParallelError sphinx.util.ExtensionError :full: .. autoclasstree:: sphinx.util.SphinxParallelError sphinx.util.ExtensionError :full: Or directly the module:: .. autoclasstree:: sphinx.util .. autoclasstree:: sphinx.util Installation ------------ You can install it using pip :: pip install sphinxcontrib-mermaid Then add ``sphinxcontrib.mermaid`` in ``extensions`` list of your project's ``conf.py``:: extensions = [ ..., 'sphinxcontrib.mermaid' ] Directive options ------------------ ``:alt:``: determines the image's alternate text for HTML output. If not given, the alternate text defaults to the mermaid code. ``:align:``: determines the image's position. Valid options are ``'left'``, ``'center'``, ``'right'`` ``:caption:``: can be used to give a caption to the diagram. ``:zoom:``: can be used to enable zooming the diagram. For a global config see ``mermaid_d3_zoom``` bellow. .. figure:: https://user-images.githubusercontent.com/16781833/228022911-c26d1e01-7f71-4ab7-bb33-ce53056f8343.gif :align: center A preview after adding ``:zoom:`` option only to the first diagram example above: Config values ------------- ``mermaid_output_format`` The output format for Mermaid when building HTML files. This must be either ``'raw'`` ``'png'`` or ``'svg'``; the default is ``'raw'``. ``mermaid-cli`` is required if it's not ``raw`` ``mermaid_version`` The version of mermaid that will be used to parse ``raw`` output in HTML files. This should match a version available on https://unpkg.com/browse/mermaid/. The default is ``"10.2.0"``. If you need a newer version, you'll need to add the custom initialization. See below. If it's set to ``""``, the lib won't be automatically included from the CDN service and you'll need to add it as a local file in ``html_js_files``. For instance, if you download the lib to `_static/js/mermaid.js`, in ``conf.py``:: html_js_files = [ 'js/mermaid.js', ] ``mermaid_init_js`` Mermaid initilizaction code. Default to ``"mermaid.initialize({startOnLoad:true});"``. .. versionchanged:: 0.7 The init code doesn't include the `' in index ) assert "" in index assert ( """
sequenceDiagram participant Alice participant Bob Alice->John: Hello John, how are you?
""" in index ) @pytest.mark.sphinx("html", testroot="basic") def test_html_zoom_option(index, app): assert "svg.call(zoom);" not in index zoom_page = (app.outdir / "zoom.html").read_text().replace("' in index ) @pytest.mark.sphinx("html", testroot="basic", confoverrides={"mermaid_version": None}) def test_conf_mermaid_no_version(app, index): # requires local mermaid assert "mermaid.min.js" not in index @pytest.mark.sphinx( "html", testroot="basic", confoverrides={"mermaid_init_js": "custom script;"} ) def test_mermaid_init_js(index): assert "" not in index assert "" in index @pytest.mark.sphinx("html", testroot="markdown") def test_html_raw_from_markdown(index): assert ( '' in index ) assert "" in index assert ( """
sequenceDiagram participant Alice participant Bob Alice->John: Hello John, how are you?
""" in index )