简体   繁体   English

在Sphinx文档期间覆盖.rst文件

[英]overwrite .rst files during Sphinx documentation

Let us say that we have a document structure that looks like the following 假设我们有一个如下所示的文档结构

.
|____src
| |____abc.py
|____docs

Now we generate documentation with the command: 现在,我们使用以下命令生成文档:

sphinx-apidoc -F -o docs src

This generates several files within the ./docs/ folder that, including a ./docs/abc.rst , which I can now build using a make html within the ./docs/ folder. 这将在./docs/文件夹中生成几个文件, 包括 ./docs/abc.rst ,我现在可以使用./docs/文件夹中的make html来构建./docs/文件。

Now, after adding some additional function within ./src/abc.py I want to rebuild the documentation. 现在,在./src/abc.py添加一些其他功能./src/abc.py我想重建文档。 I try the same things and Sphinx says that the rest file is already present and as a result, it doesn't get updates. 我尝试相同的操作,Sphinx说其余文件已经存在,因此它没有更新。 I have to manually delete the relevant files before I can update the documentation. 在更新文档之前,我必须手动删除相关文件。

Now the question is, how do I do the entire process without having to resort to deleting the .rst files. 现在的问题是,如何执行整个过程而不必诉诸于删除.rst文件。

sphinx-apidoc has a --force option for overwriting files. sphinx-apidoc具有--force选项,用于覆盖文件。

See http://www.sphinx-doc.org/en/stable/man/sphinx-apidoc.html#sphinx-apidoc-manual-page . 参见http://www.sphinx-doc.org/en/stable/man/sphinx-apidoc.html#sphinx-apidoc-manual-page

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM