繁体   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