Skip to content

Commit eb2cc53

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

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
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 & 2 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,36 @@
3031
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
3132

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

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

4259
extensions = [
4360
"sphinx.ext.autodoc",
4461
"sphinx.ext.viewcode",
4562
"sphinx.ext.githubpages",
63+
"sphinxcontrib.mermaid",
4664
"myst_parser",
4765
]
4866

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)