[英]Including ipynb files in sphinx index.rst when they are located in a subdirectory
我被 pythons sphinx
困住了。 我的目录树如下所示:
| - project_root
| | - importable_project
| | | - importable_module.py
| | | - another_importable_module.py
| | | - Tutorials
| | | | - tutorial1.ipynb
| | - docs
| | | - build
| | | | - sphinx_build_files_and_folders
| | | - source
| | | | - _static
| | | | - _templates
| | | | - conf.py
| | | | - index.rst
| | | | - modules.rst
我已按照说明启用了nbsphinx 扩展,并且正在修改源文件夹中的index.rst
文件。
以下是index.rst
文件当前的样子:
.. Pycotools documentation master file, created by
sphinx-quickstart on Wed Oct 11 11:46:06 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Pycotools's documentation!
=====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
/modules
../../importable_project/Tutorials/tutorial1
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
其中大部分是由sphinx-quickstart
自动生成的。 我知道这里指定的文件路径是相对于index.rst
文件的位置的。 因此,在这种情况下, project_root/docs/source
和 sphinx 能够使用上面的index.rst
文件为moudles.rst
生成 html。
问题是我想在文档中包含我的教程,但../../importable_project/Tutorials/tutorial1
行无法找到tutorial1.ipynb
。
有人可以建议我做错了什么吗?
教程是文档,应该移到docs/source
目录中。 Sphinx 无法在其源目录之外找到文件,除了通过 autodoc 的包。 移动.ipynb
文件后,您需要相应地调整路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.