如何创建一个不会出现在目录树中的狮身人面像标题

2024-05-18 13:58:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用sphinx为python模块创建文档。在

我想在页面上添加字幕,但我不希望它们出现在目录树中。在

我想要小部分和简短(几行)的描述。将每个部分标题添加到目录树中会使浏览文档更加困难。在

这是我的索引.rst

Welcome to ModernGL's documentation!
====================================

.. figure:: Examples/images/02_uniforms_and_attributes.png
    :scale: 50 %
    :alt: ModernGL
    :align: center
    :figclass: align-center

Start `here <ModernGL.html>`_.

.. toctree::
    :maxdepth: 4
    :caption: Contents:

    ModernGL <ModernGL.rst>
    Examples <Examples.rst>
    Contributing <Contributing.rst>


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

我想添加一些副标题:

^{pr2}$

我检查了文档,不知道应该使用哪种类型的下划线。不确定是否有特殊下划线将标题转换为<h4>或{}

With a github README.md adding more # characters will result in smaller titles. What is the equivalent in *.rst?

The build documentation can be found here and it does not contain subtitles since it would ruin the current structure of the docs.


Tags: andthein文档目录ref标题here
1条回答
网友
1楼 · 发布于 2024-05-18 13:58:03

您是否尝试在toctree指令中添加^{}?比如:

.. toctree::
    :maxdepth: 4
    :hidden:
    :caption: Contents:

    ModernGL <ModernGL.rst>
    Examples <Examples.rst>
    Contributing <Contributing.rst>

This will still notify Sphinx of the document hierarchy, but not insert links into the document at the location of the directive – this makes sense if you intend to insert these links yourself, in a different style, or in the HTML sidebar.

至于“部分标题”(标题和副标题),这段摘录自official Sphinx documentation可能会给你一个答案:

Normally, there are no heading levels assigned to certain characters as the structure is determined from the succession of headings.

您可以尝试在子部分中使用^字符来呈现所需的标题。在

相关问题 更多 >

    热门问题