Skip to content

Commit cea2393

Browse files
Sphinx: Enable support for mermaid diagrams in Markdown and RST
Signed-off-by: Bernhard Kaindl <[email protected]>
1 parent cf8229f commit cea2393

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
six
22
sphinx
33
sphinx-autodoc-typehints
4+
sphinxcontrib-mermaid
45
furo
56
myst_parser

docs/source/accessor.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
xcp.accessor
22
=============
33

4+
.. autoclasstree:: xcp.accessor
5+
:title: Accessor class hierarchy
6+
:caption: (class hierarchy automatically generated from xcp.accessor using Sphinx's autoclasstree directive)
7+
:full:
8+
49
.. automodule:: xcp.accessor
510
:members:
611
:undoc-members:

docs/source/conf.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
import os
55
import sys
6+
from datetime import datetime
67

78
# For the full list of built-in configuration values, see the documentation:
89
# https://www.sphinx-doc.org/en/master/usage/configuration.html
@@ -30,19 +31,35 @@
3031
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
3132

3233
project = "python-libs"
33-
copyright = "2025, Citrix Inc."
34+
copyright = "2025, Citrix Inc." # pylint: disable=redefined-builtin
3435
author = "Citrix Inc."
35-
from datetime import datetime
36-
3736
release = datetime.now().strftime("%Y.%m.%d-%H%M")
3837

38+
# -- Options for HTML output -------------------------------------------------
39+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html
40+
# Set the favicon and logo to XenServer branding.
41+
html_favicon = "https://xenserver.com/content/dam/xenserver/images/favicon-32x32.png"
42+
html_logo = "https://www.xenserver.com/content/dam/xenserver/images/xenserver-full-color-rgb.svg"
43+
44+
# -- MyST-Parser configuration -----------------------------------------------
45+
# https://github.com/mgaitan/sphinxcontrib-mermaid:
46+
# Enables GitHub-style mermaid code blocks in markdown files.
47+
# See https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
48+
# This allows to use mermaid code blocks in markdown files like this:
49+
# ```mermaid
50+
# graph TD;
51+
# A-->B;
52+
# ```
53+
myst_fence_as_directive = ["mermaid"]
54+
3955
# -- General configuration ---------------------------------------------------
4056
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
4157

4258
extensions = [
4359
"sphinx.ext.autodoc",
4460
"sphinx.ext.viewcode",
4561
"sphinx.ext.githubpages",
62+
"sphinxcontrib.mermaid",
4663
"myst_parser",
4764
]
4865

docs/source/repository.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
xcp.repository
22
==============
33

4+
.. autoclasstree:: xcp.repository
5+
:title: Repository class hierarchy
6+
:caption: (class hierarchy automatically generated from xcp.repository using Sphinx's autoclasstree directive)
7+
:full:
8+
49
.. automodule:: xcp.repository
510
:members:
611
:undoc-members:

0 commit comments

Comments
 (0)