0
我被pythons卡住sphinx
。我的目錄樹是這個樣子:當它們位於子目錄中時,在sphinx index.rst中包含ipynb文件
| - 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 extention按照指示,我修改源文件夾中的文件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能夠爲moudles.rst
生成html,上面的文件爲index.rst
。
問題是我想將我的教程包含在文檔中,但行../../importable_project/Tutorials/tutorial1
無法找到tutorial1.ipynb
。
有人可以建議我做錯了什麼嗎?
教程是文檔,應該移到'docs/source'目錄。獅身人面像無法在源目錄之外找到文件,除了通過autodoc打包。移動'.ipynb'文件後,您需要相應地調整路徑。 –
謝謝。這工作。發表一個答案,我會接受。 – CiaranWelsh