如何配置 sphinx 扩展?
How do I configure a sphinx extension?
在关于 sphinx 扩展的文档中有一些“配置值”。例如在 sphinx.ext.autodoc.
但我不知道如何设置这些值。是shell上的参数我要设置吗?
文档中有一个页面教授如何使用扩展。页面在这里:https://www.sphinx-doc.org/en/master/usage/extensions/index.html
在 this page 中您有以下描述:
A list of strings that are module names of extensions. These can be extensions coming with Sphinx (named sphinx.ext.*) or custom ones.
这告诉你 sphinx.ext.*
是 built-ins 扩展名(你可以从 here 确认)
基本上当它说某种配置时,它指的是当你运行 sphinx-quickstart
时生成的conf.py
文件,这是一个quick-setup命令一般的狮身人面像(可能是一本好书:https://www.sphinx-doc.org/en/master/usage/quickstart.html)
The root directory of a Sphinx collection of plain-text document sources is called the source directory. This directory also contains the Sphinx configuration file conf.py, where you can configure all aspects of how Sphinx reads your sources and builds your documentation.
Sphinx comes with a script called sphinx-quickstart that sets up a source directory and creates a default conf.py with the most useful configuration values from a few questions it asks you.
请注意,因为它是 built-in,所以它已经与您的 sphinx 项目一起设置。
但是如果你想以某种方式自定义它,你可以使用 conf.py 文件和 autodoc_*
配置(如所列 here)
还有一些注释可能对您的案例有用
For Sphinx (actually, the Python interpreter that executes Sphinx) to find your module, it must be importable. That means that the module or the package must be in one of the directories on sys.path – adapt your sys.path in the configuration file accordingly.
在关于 sphinx 扩展的文档中有一些“配置值”。例如在 sphinx.ext.autodoc.
但我不知道如何设置这些值。是shell上的参数我要设置吗?
文档中有一个页面教授如何使用扩展。页面在这里:https://www.sphinx-doc.org/en/master/usage/extensions/index.html
在 this page 中您有以下描述:
A list of strings that are module names of extensions. These can be extensions coming with Sphinx (named sphinx.ext.*) or custom ones.
这告诉你 sphinx.ext.*
是 built-ins 扩展名(你可以从 here 确认)
基本上当它说某种配置时,它指的是当你运行 sphinx-quickstart
时生成的conf.py
文件,这是一个quick-setup命令一般的狮身人面像(可能是一本好书:https://www.sphinx-doc.org/en/master/usage/quickstart.html)
The root directory of a Sphinx collection of plain-text document sources is called the source directory. This directory also contains the Sphinx configuration file conf.py, where you can configure all aspects of how Sphinx reads your sources and builds your documentation.
Sphinx comes with a script called sphinx-quickstart that sets up a source directory and creates a default conf.py with the most useful configuration values from a few questions it asks you.
请注意,因为它是 built-in,所以它已经与您的 sphinx 项目一起设置。
但是如果你想以某种方式自定义它,你可以使用 conf.py 文件和 autodoc_*
配置(如所列 here)
还有一些注释可能对您的案例有用
For Sphinx (actually, the Python interpreter that executes Sphinx) to find your module, it must be importable. That means that the module or the package must be in one of the directories on sys.path – adapt your sys.path in the configuration file accordingly.