Python sphinx 在文档中添加子节后,如何提升级别?

Python sphinx 在文档中添加子节后,如何提升级别?,python-sphinx,restructuredtext,docutils,Python Sphinx,Restructuredtext,Docutils,我有一个经过重组的文本文档,其中包含几个层次结构部分,例如: Main title ########## Text under the main title. Sub-section =========== Text under the sub-section. 这非常有效,当我使用Sphinx编译它时,我得到了正确的HTML格式 我的问题是:如何提升层次结构级别,以便在几个小节之后添加更多文本 例如: Main title ########## Text under the main

我有一个经过重组的文本文档,其中包含几个层次结构部分,例如:

Main title
##########

Text under the main title.

Sub-section
===========

Text under the sub-section.
这非常有效,当我使用Sphinx编译它时,我得到了正确的HTML格式

我的问题是:如何提升层次结构级别,以便在几个小节之后添加更多文本

例如:

Main title
##########

Text under the main title.

Sub-section
===========

Text under the sub-section.

In my CSS, sub-section is indented.
I want this paragraph to be rendered as part of the Main title section,
not the sub-section.
我基本上是在寻找一种提升层次的方法

这可能吗

谢谢

如果不在您想要的级别上开始新的部分,就不可能“向上”层次结构。文档节结构不是这样工作的。章节级别的更改必须以相应的章节标题开头。使用缩进来表示类似截面的结构只应在有限的局部范围内使用

你所描述的不是一个小节,而是一个主题。Docutils对此有一个指令:

.. topic:: title

   Topic text.

   May include multiple body elements (paragraphs, lists, etc.).
对于类似的结构,也有一个“侧边栏”指令,但通常是针对一个偏侧的平行主题。“rubric”指令也可能引起关注

有关详细信息,请参阅