我正在使用sphinx来记录一个python项目。我想添加一些教程作为*.ipynb。 我有一个关于如何渲染jupyter笔记本的问题。这是我的密码
我创建了一个docs文件夹,所有sphinx命令都将在此文件夹下运行。下面是我的项目结构
demos/
src/
docs/
source/
config.py
demos.rst
modules.rst
src.rst
index.rst
....
build/
以下是demos.rst
的内容
Demonstration
=============
demos.tuto1
----------------------
demos/tuto1.ipynb
demos.tuto2
-------------------
demos/tuto2.ipynb
以下是index.rst
的内容
Welcome to my python project
============================
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
src
demos
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
在config.py
文件中:
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autodoc', 'nbsphinx']
nbsphinx_execute = 'never'
nbsphinx_allow_errors = True
source_suffix = ['.rst', '.ipynb']
html_theme = 'sphinx_rtd_theme'
当我运行make html
时,我渲染除jupyter笔记本之外的所有内容。
我错过了什么
您混淆了两个不同上下文之间的语法
如果您有一个
toctree
条目上下文,例如在index.rst
中,则可以执行以下操作:如果希望有一个单独的"normal reST file",则可以执行以下操作:
相关问题 更多 >
编程相关推荐