如何使用 glob 更改 toctree 中的标题?

How to change titles in a toctree using glob?

我在我的 sphinx 项目中使用了一个带有 glob 选项的 toctree,我想显示与我的文件的 H1 或使用 Titlesonly 作为 toctree 选项的文件名不同的标题。

这是我的代码截图:

在 index.md 中有 README.md 个我项目的文件

```{toctree}
---
maxdepth: 1
glob:
---
src/*/*

我想显示 'Project Root' 例如 'audit' 而不是文件标题 'Projet audit @shared'

这是README.md

的截图
# Projet audit @shared

* Project Root: `audit`

您不能使用 glob 指定文档标题。 showing custom titles in reST is described in the documentation.

的语法

Entries

Document titles in the toctree will be automatically read from the title of the referenced document. If that isn’t what you want, you can specify an explicit title and target using a similar syntax to reST hyperlinks (and Sphinx’s cross-referencing syntax). This looks like:

.. toctree::

    intro
    All about strings <strings>
    datatypes