Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 1.3 KB

File metadata and controls

63 lines (43 loc) · 1.3 KB

Using sphinx for documentation

TODO

Using sphinx-togglebutton for the questions

TODO

Using matplotlib for plotting directives

The matplotlib library includes a sphinx plugin that allows for plot directives. To enable it, ensure that "matplotlib.sphinxext.plot_directive" is included in extensions in conf.py.

For example the following will create a plot:

.. plot::

   import matplotlib.pyplot as plt
   import numpy as np

   xs = np.linspace(0, 10)
   plt.plot(xs, np.cos(xs))

import matplotlib.pyplot as plt import numpy as np

xs = np.linspace(0, 10) plt.plot(xs, np.cos(xs))

Using mermaid for diagrams

A popular tool for drawing diagrams is mermaid.js. This can be used directly with sphinx. To enable it, ensure that "sphinxcontrib.mermaid" is included in extensions in conf.py.

For example the following will create a flowchart:

.. mermaid::

   graph TD;
      A-->B;
      A-->C;
      B-->D;
      C-->D;
graph TD;

A-->B; A-->C; B-->D; C-->D;