目前,每当我运行sphinx-build
时,只有在源文件发生更改时才会选择并使用内联文档字符串。我试过sphinx-build
用-a
开关打电话,但这似乎没有效果。
如何强制完全重建 HTML 输出并强制执行 autodoc?
目前,每当我运行sphinx-build
时,只有在源文件发生更改时才会选择并使用内联文档字符串。我试过sphinx-build
用-a
开关打电话,但这似乎没有效果。
如何强制完全重建 HTML 输出并强制执行 autodoc?
如果该-E
选项与-a
. 我将它添加到html
我的目标中,现在在不更新任何文件Makefile
的情况下拾取文档字符串中的更改。.rst
我不使用 sphinx-build 但使用 make html 我总是touch *.rst
在我的源文件上使用。然后使 html 可以拾取更改。
我使用 的clean
子命令make
来强制重建文档(正如@Henrik 在他的评论中所说)。
您可以将其作为单独的命令发出:
make clean
make html
或者可以组合命令:
make clean html
对于 Windows 用户,在此答案的基础上使用 -E -a 选项,我使用新选项更新了 make.bat 文件
> ./make.bat clean
制作.bat
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
set SPHINXOPTS=
set TARGET=%1
if "%1" == "" goto help
if "%1" == "clean" goto clean
goto :run
:clean
echo.CLEAN BUILD with -E -a
set %TARGET% = "html"
set %SPHINXOPTS% = "-E -a"
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found! Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you do not have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:run
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
echo. clean to make clean.
:end
popd