rest
sphinx.ext.graphviz
0.6
This extension allows you to embed Graphviz graphs in your documents.
It adds these directives:
There are also these config values:
graphviz_dot
The command name with which to invoke dot
. The default is 'dot'
; you may need to set this to a full path if dot
is not in the executable search path.
Since this setting is not portable from system to system, it is normally not useful to set it in conf.py
; rather, giving it on the sphinx-build
command line via the -D <sphinx-build -D>
option should be preferable, like this:
sphinx-build -b html -D graphviz_dot=C:\graphviz\bin\dot.exe . _build/html
graphviz_dot_args
Additional command-line arguments to give to dot, as a list. The default is an empty list. This is the right place to set global graph, node or edge attributes via dot's -G
, -N
and -E
options.
graphviz_output_format
The output format for Graphviz when building HTML files. This must be either 'png'
or 'svg'
; the default is 'png'
. If 'svg'
is used, in order to make the URL links work properly, an appropriate target
attribute must be set, such as "_top"
and "_blank"
. For example, the link in the following graph should work in the svg output: :
.. graphviz::
digraph example {
a [label="sphinx", href="https://www.sphinx-doc.org/", target="_top"];
b [label="other"];
a -> b;
}
1.0 Previously, output always was PNG.