label in python docstring

418 Views Asked by At

I'm using sphinx autodoc to translate my docstring to a nice documentation page. In the docstring I'm following numpy's docstring guideline by using the sphinx napoleon extension. I'm wondering about the following: If I have an equation like

"""
This is a very important equation which is used in the code

.. math::

     a+b=c
   :label: important_eq
"""

the autodoc doesn't recognize the :label:. Do I have a wrong formatting or can't autodoc / mathjax / napoleon deal with labels in equations?

1

There are 1 best solutions below

0
On BEST ANSWER

Be careful with whitespace and indentation. This works:

.. math::
   :label: important_eq

   a+b=c

This works too (when the math content is only one line of text, it can be given as a directive argument):

.. math:: a+b=c
   :label: important_eq