Python sphinx 在警告中包含文字块

Python sphinx 在警告中包含文字块,python-sphinx,restructuredtext,Python Sphinx,Restructuredtext,我是个新手。我想创建一个包含一行代码的警告块 以下是四种尝试: .. WARNING:: Base case - This doesn't format the next line as a literal:: $ ls / .. WARNING:: Split over two lines - This still doesn't format the next line as a literal:: $ ls / .. WARNING:: Indented - Stil

我是个新手。我想创建一个包含一行代码的警告块

以下是四种尝试:

.. WARNING:: Base case - This doesn't format the next line as a literal::
   $ ls /

.. WARNING:: Split over two lines - This still doesn't format the next line
   as a literal::
   $ ls /

.. WARNING:: Indented - Still no luck::
     $ ls /

.. WARNING:: Split line AND indented. Works, but gives a warning "Unexpected
   indentation"::
     $ ls /
这是斯芬克斯的结果

最后一个例子给出了我正在寻找的输出,但是当Sphinx运行它时,我收到了一条警告

我遗漏了什么?

我算出了。发布后不久,我通过点击任意按钮随机点击一个答案,直到它起作用:

.. WARNING:: The magic incantation - a blank line::

   $ ls /