[英]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.