gpt4 book ai didi

python - 在 reStructuredText(使用 Spinx)中使用文字 block 时如何修复列表缩进?

转载 作者:行者123 更新时间:2023-11-30 23:34:50 25 4
gpt4 key购买 nike

对于文档项目,我想以项目符号列表的形式提供代码示例。我使用 Sphinx 将 .rst 文件转换为 HTML。这工作得很好,直到我开始在列表项中使用文字 block 。在下面的示例中,我想在与“给定 XML 文件...”相同的级别上显示“执行以下代码之后”这句话。但是它会自动缩进。

Example
--------

- Given an XML-file note.xml, which contains:

::

<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

After executing the following code:

::

xml = loadxml ("<your path to file>/note.xml");
parent = xpath(xml, "//note"); //get main node
addsubnode (parent, "<comment>Comments are welcome.</comment>");

PS:别介意代码,它是一种特殊的语言。

最佳答案

偶然发现了解决方案。事实证明非常简单,只需将项目符号后面的行留空即可:

Examples
--------

-

Given an XML-file note.xml, which contains:

::

<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

After executing the following code:

::

xml = loadxml ("<your path to file>/note.xml");
parent = xpath(xml, "//note"); //get main node
addsubnode (parent, "<comment>Comments are welcome.</comment>");

关于python - 在 reStructuredText(使用 Spinx)中使用文字 block 时如何修复列表缩进?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17880068/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com