我有以下文档字符串:
def test(foo):
"""this is my function
.. code-block:: python
cool function
now I should be outside the codeblock.
But I'm not?
.. code-block:: python
next function
I'm still inside the original codeblock?
:param foo: _description_
:type foo: _type_
"""
在 VScode 中呈现如下:
我是否编写了错误的语法,或者 VScode 只是在处理 sphinx 格式的渲染时遇到了困难?
1。为代码块添加一定程度的缩进
def test(foo):
"""this is my function
.. code-block:: python
cool function
now I should be outside the codeblock.
But I'm not?
.. code-block:: python
next function
I'm still inside the original codeblock?
:param foo: _description_
:type foo: _type_
"""
2。删除非代码块的一级缩进
def test(foo):
"""this is my function
.. code-block:: python
cool function
now I should be outside the codeblock.
But I'm not?
.. code-block:: python
next function
I'm still inside the original codeblock?
:param foo: _description_
:type foo: _type_
"""
我不确定这是否是正确的语法,或者是否是 vscode 错误。如果有人认为这是一个错误,您可以在 GitHub 上报告并在此处分享链接。