2017-10-11 87 views
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

有人可以建議我做錯了什麼嗎?

+1

教程是文檔,應該移到'docs/source'目錄。獅身人面像無法在源目錄之外找到文件,除了通過autodoc打包。移動'.ipynb'文件後,您需要相應地調整路徑。 –

+0

謝謝。這工作。發表一個答案,我會接受。 – CiaranWelsh

回答

2

教程是文檔,應該移到docs/source目錄中。獅身人面像無法在源目錄之外找到文件,除了通過autodoc打包。移動.ipynb文件後,您需要相應地調整路徑。

相關問題