Python sphinx 定义术语的定义必须缩进。您可以看到Pyramid的示例和文档。就我个人而言,我认为最好只是命名这个术语,然后定义它,而不是尝试命名它并用多行标记定义它。 my_list = [ 'One', 'Two', 'Three', ] m

Python sphinx 定义术语的定义必须缩进。您可以看到Pyramid的示例和文档。就我个人而言,我认为最好只是命名这个术语,然后定义它,而不是尝试命名它并用多行标记定义它。 my_list = [ 'One', 'Two', 'Three', ] m,python-sphinx,read-the-docs,Python Sphinx,Read The Docs,定义术语的定义必须缩进。您可以看到Pyramid的示例和文档。就我个人而言,我认为最好只是命名这个术语,然后定义它,而不是尝试命名它并用多行标记定义它。 my_list = [ 'One', 'Two', 'Three', ] my_dict = { 'One': 1, 'Two': 2, 'Three': 3, } STD_LIST = [ 'item1', 'item2', 'item3', ] | **S

定义术语的定义必须缩进。您可以看到Pyramid的示例和文档。就我个人而言,我认为最好只是命名这个术语,然后定义它,而不是尝试命名它并用多行标记定义它。
my_list = [
    'One',
    'Two',
    'Three',
]

my_dict = {
    'One': 1,
    'Two': 2,
    'Three': 3,
}
STD_LIST = [
    'item1',
    'item2',
    'item3',
]
|     **STD_LIST = [**
|         **'item1',**
|         **'item2',**
|         **'item3',**
|     **]**

        This list is very important. Please do not modify it unless you know
        what you are doing. Best not to touch it ever!

        .. warning:: Don't touch :py:const:`STD_LIST` unless you know what \
        you are doing.
|     **STD_LIST = [**
|         **'item1',**
|         **'item2',**
|         **'item3',**
|     **]**
|         This list is very important. Please do not modify it unless you know
          what you are doing. Best not to touch it ever!

          .. warning:: Don't touch :py:const:`STD_LIST` unless you know what \
          you are doing.
|

    **NEXT_CONST = 'Stackoverflow.com is amazing!'**
        A shoutout to the stackoverflow.com admins and users. This is a normal constant 
        string and doesn't need any vertical bar trickery to get Sphinx to format it 
        nicely.
|     **STD_LIST = [**
|         **'item1',**
|         **'item2',**
|         **'item3',**
|     **]**
|         This list is very important. Please do not modify it unless you know
          what you are doing. Best not to touch it ever!
|

          .. warning:: Don't touch :py:const:`STD_LIST` unless you know what \
          you are doing.

    **NEXT_CONST = 'Stackoverflow.com is amazing!'**
        A shoutout to the stackoverflow.com admins and users. This is a normal constant 
        string and doesn't need any vertical bar trickery to get Sphinx to format it 
        nicely.
Some introductory text about ``STD_LIST``.

    .. code-block:: python

        STD_LIST = [
            'item1',
            'item2',
            'item3',
        ]

    This list is very important. Please do not modify it unless you know what you are doing. Best not to touch it ever!

    .. warning::

        Don't touch :py:const:`STD_LIST` unless you know what you are doing.

Some introductory text about ``NEXT_CONST``.

    .. code-block:: python

        NEXT_CONST = 'Stackoverflow.com is amazing!'

    A shoutout to the stackoverflow.com admins and users. This is a normal constant string and doesn't need any vertical bar trickery to get Sphinx to format it nicely.