簡體   English   中英

當它們位於子目錄中時,將 ipynb 文件包含在 sphinx index.rst 中

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

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM