Skip to content

Commit

Permalink
feat: add mermaid.js support (#1302)
Browse files Browse the repository at this point in the history
* chore: add diagrams

* docs: improve example

* chore: add mermaid by default
  • Loading branch information
dgarcia360 authored Dec 10, 2024
1 parent 2027062 commit 7790055
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
24 changes: 24 additions & 0 deletions docs/source/examples/diagrams.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Diagrams
========

The documentation toolchain supports rendering diagrams and charts using `Mermaid <https://mermaid.js.org/intro/>`_, a library designed for creating sequence diagrams, flowcharts, and other visualizations.

Using:

.. code-block:: python
.. mermaid ::
graph TD
A --> B
B -- Label --> C
Renders:

.. mermaid ::
graph TD
A --> B
B -- Label --> C
For more details, refer to the `sphinxcontrib-mermaid <https://sphinxcontrib-mermaid-demo.readthedocs.io/en/latest/>`_ documentation.
2 changes: 2 additions & 0 deletions docs/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ In general, there are main components to the markup of any document:
admonitions
collapse
code-blocks
diagrams
glossary
headings
hero-box
Expand Down Expand Up @@ -44,6 +45,7 @@ In general, there are main components to the markup of any document:
* :doc:`Admonitions <admonitions>`
* :doc:`Collapse <collapse>`
* :doc:`Code blocks <code-blocks>`
* :doc:`Diagrams <diagrams>`
* :doc:`Glossary <glossary>`
* :doc:`Headings <headings>`
* :doc:`Hero box <hero-box>`
Expand Down
20 changes: 19 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pyyaml = "^6.0.1"
Sphinx-Substitution-Extensions = ">=2022.2.16,<2025.0.0"
sphinx-notfound-page = "^1.0.4"
setuptools = ">=70.1.1,<76.0.0"
sphinxcontrib-mermaid = "^1.0.0"

[tool.poetry.dev-dependencies]
pytest = "^8.3.2"
Expand Down
2 changes: 2 additions & 0 deletions sphinx_scylladb_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sphinx_collapse
import sphinx_copybutton
import sphinx_substitution_extensions
from sphinxcontrib import mermaid
from notfound import extension as not_found
from sphinx_tabs import tabs

Expand Down Expand Up @@ -102,6 +103,7 @@ def setup(app):

"""Setup thid-party extensions"""
not_found.setup(app)
mermaid.setup(app)
sphinx_collapse.setup(app)
sphinx_copybutton.setup(app)
sphinx_substitution_extensions.setup(app)
Expand Down

0 comments on commit 7790055

Please sign in to comment.