sphinx可以链接到位于.rst文档上方一个路径中的文档吗?

问题描述

我正在尝试使用Sphinx的基础知识来记录一个小项目。但是我无法让他找到上面目录中的文件。

项目结构如下:

/ Users / machine / workspace / project1

├── BDRespostas.py
├── constantes.py
├── docs
│   ├── conf.py
│   ├── index.rst
│   └── make.bat
├── estatisticas.py
├── migrate_postgre_sqlite.py
├── preProcessamentoTextual.py
└──

而且我尝试了几种方法来配置index.rst,但没有成功:

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   :ref:'estatisticas.py'
   ../BDRespostas.py
   '/Users/machine/workspace/project1/constantes.py'

我还结合了几次尝试,将sys.path.insert()添加到项目目录中。如果您已经成功地进行了引用并可以对我有所帮助,我将非常感谢。

解决方法

如上所述,toctree用于包含文档(.rst文件),而不是Python源。告诉我们您想要实现什么。

为了不掩盖它-toctree只能包含当前文件夹或子文件夹中的文档。即你不能

.. toctree::
   
   ../one.rst
   ../two/three.rst

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...