https://github.com/doreapp/sphinx-mermaid
Mermaid graph support for sphinx generated documentations
https://github.com/doreapp/sphinx-mermaid
diagram mermaid mermaid-diagrams mermaidjs python restructuredtext rst sphinx sphinx-extension
Last synced: about 2 months ago
JSON representation
Mermaid graph support for sphinx generated documentations
- Host: GitHub
- URL: https://github.com/doreapp/sphinx-mermaid
- Owner: Doreapp
- License: mit
- Created: 2022-11-26T13:32:19.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T13:05:31.000Z (almost 3 years ago)
- Last Synced: 2025-08-22T02:03:29.022Z (about 2 months ago)
- Topics: diagram, mermaid, mermaid-diagrams, mermaidjs, python, restructuredtext, rst, sphinx, sphinx-extension
- Language: Python
- Homepage: https://doreapp.github.io/sphinx-mermaid/
- Size: 2.74 MB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mermaid support for Sphinx documentation
[Mermaid graphs](https://mermaid-js.github.io/mermaid/#/) support for [sphinx generated documentations](https://www.sphinx-doc.org/en/master/).
- [GitHub repository at Doreapp/sphinx-mermaid](https://github.com/Doreapp/sphinx-mermaid/)
- [Pypi package sphinx-mermaid](https://pypi.org/project/sphinx-mermaid/)
- Example of usage: [GitHub pages of this repo](https://doreapp.github.io/sphinx-mermaid/)## Install
```bash
pip install sphinx-mermaid
```## Setup in `conf.py`
In the `conf.py` file of your documentation, add the extension:
```python
extensions = [
...,
'sphinxmermaid'
]
```### Config Options
`sphinxmermaid_mermaid_init` can be set as a dictionary of values.
These will be passed to `mermaid.initialize()`. Find more info at
[MermaidJS](https://mermaid.js.org/intro/n00b-syntaxReference.html)Example:
```python
sphinxmermaid_mermaid_init = {
'theme': 'base',
'themeVariables': {
'primaryColor': '#BB2528',
'primaryTextColor': '#fff',
'primaryBorderColor': '#7C0000',
'lineColor': '#F8B229',
'secondaryColor': '#006100',
'tertiaryColor': '#fff'
}
}
```## Usage
In your `rst` (or `md`) files, use the directive just like:
```rst
.. mermaid ::graph TD
A --> B
B -- Label --> C
```