如何在 Sphinx 中制作教程页面?

How do you make a tutorial page in Sphinx?

我了解如何使用 numpy 文档字符串来记录各个 类 和方法等,但我还希望有一个页面向用户展示如何在我们设施的环境中使用我的包(即如何访问Jupyter笔记本,如何将我的包加载到其中,如何设置环境,以及如何在实践中使用它)。有没有办法直接在 Sphinx 中执行此操作?还是我需要使用其他程序来构建 HTML 页面?

是的!通常,当您想编写散文文档时,您会直接将其写入 Sphinx 文档目录中的 reStructuredText 文件。

因此,例如,您将创建一个 installation.rst,它可能如下所示:

Installation
============

To access the Jupyter notebook, go to `this site <https://example.com>`_

然后,您将 index.rst 中的 Table 目录编辑为如下所示:

.. toctree::
   :maxdepth: 2

   installation
   some_other_preexisting_page
   another_preexisting_page

(假设您的 Sphinx 设置看起来与 sphinx-quickstart 创建的有点相似。)