Graphviz Example

There is a plugin for sphinx called sphinx.ext.graphviz which adds support for embedding graphviz graphs in your documents. One can achieve this by following these instructions:

  1. Make sure graphviz is properly installed on your machine/environment, for instance it can be installed via conda like this:

    conda install -c conda-forge graphviz
    
  2. Make sure that this plugin would be recognized in your conf.py by adding it to the extentions list

    Note

    In this project the conf.py is generated by cmake from the conf.py.in file and therefore this addition should be added to conf.py.in since it’s the template file for the generated conf.py.

    extentions = [
        ...
        "sphinx.ext.graphviz",
        ...
    ]
    

After those instructions you should be able to add the following directives in your .rst files

.. graphviz::

   digraph foo {
      "bar" -> "baz";
   }

Here is how it looks:

digraph foo {
   "bar" -> "baz";
}