【问题标题】:label in python docstringpython 文档字符串中的标签
【发布时间】:2017-10-03 13:09:42
【问题描述】:

我正在使用 sphinx autodoc 将我的文档字符串翻译成一个不错的文档页面。在文档字符串中,我通过使用 sphinx 拿破仑扩展来遵循 numpy 的文档字符串指南。我想知道以下几点:如果我有一个类似的方程式

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

.. math::

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

自动文档无法识别:label:。我的格式是否错误,或者 autodoc / mathjax / napoleon 无法处理方程式中的标签?

【问题讨论】:

    标签: python-sphinx mathjax autodoc numpydoc


    【解决方案1】:

    注意空格和缩进。这有效:

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

    这也有效(当数学内容只有一行文本时,它可以作为指令参数给出):

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-27
      • 1970-01-01
      • 2017-11-27
      • 2017-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多