Skip to content

Commit 9559cf2

Browse files
committed
docs: add devenv and linkcheck
1 parent b4a1b50 commit 9559cf2

File tree

5 files changed

+65
-29
lines changed

5 files changed

+65
-29
lines changed

.gitpod.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ tasks:
22
- init: |
33
pip3 install sphinx-autobuild
44
pip3 install -r docs/requirements.txt
5-
pip3 install -e.
5+
pip3 install -e .
66
command: |
7-
sphinx-autobuild docs/source/ docs/build/html/
7+
sphinx-autobuild docs/source/ docs/_build/html/
88
name: Sphinx preview
99
ports:
10-
- port: 8000
10+
- port: 8000

docs/Makefile

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
1-
# Minimal makefile for Sphinx documentation
2-
#
1+
# Makefile for Sphinx documentation generated by sphinx-quickstart
2+
# ----------------------------------------------------------------------------
33

4-
# You can set these variables from the command line.
5-
SPHINXOPTS = -W
6-
SPHINXBUILD = python3 -msphinx
7-
SPHINXPROJ = repo2docker
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
88
SOURCEDIR = source
9-
BUILDDIR = build
9+
BUILDDIR = _build
1010

1111
# Put it first so that "make" without argument is like "make help".
1212
help:
13-
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
1414

1515
.PHONY: help Makefile
1616

1717
# Catch-all target: route all unknown targets to Sphinx using the new
18-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18+
# "make mode" option.
1919
%: Makefile
20-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
21+
22+
23+
# Manually added commands
24+
# ----------------------------------------------------------------------------
25+
26+
# For local development:
27+
# - builds and rebuilds html on changes to source
28+
# - starts a livereload enabled webserver and opens up a browser
29+
devenv:
30+
sphinx-autobuild -b html --open-browser "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)
31+
32+
# For local development and CI:
33+
# - verifies that links are valid
34+
linkcheck:
35+
$(SPHINXBUILD) -b linkcheck "$(SOURCEDIR)" "$(BUILDDIR)/linkcheck" $(SPHINXOPTS)
36+
@echo
37+
@echo "Link check complete; look for any errors in the above output " \
38+
"or in $(BUILDDIR)/linkcheck/output.txt."

docs/make.bat

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,51 @@ pushd %~dp0
55
REM Command file for Sphinx documentation
66

77
if "%SPHINXBUILD%" == "" (
8-
set SPHINXBUILD=python -msphinx
8+
set SPHINXBUILD=sphinx-build
99
)
1010
set SOURCEDIR=source
11-
set BUILDDIR=build
12-
set SPHINXPROJ=repo2docker
11+
set BUILDDIR=_build
1312

1413
if "%1" == "" goto help
14+
if "%1" == "devenv" goto devenv
15+
if "%1" == "linkcheck" goto linkcheck
16+
goto default
1517

18+
19+
:default
1620
%SPHINXBUILD% >NUL 2>NUL
1721
if errorlevel 9009 (
1822
echo.
19-
echo.The Sphinx module was not found. Make sure you have Sphinx installed,
20-
echo.then set the SPHINXBUILD environment variable to point to the full
21-
echo.path of the 'sphinx-build' executable. Alternatively you may add the
22-
echo.Sphinx directory to PATH.
23+
echo.The 'sphinx-build' command was not found. Open and read README.md!
24+
exit /b 1
25+
)
26+
%SPHINXBUILD% -M %1 "%SOURCEDIR%" "%BUILDDIR%" %SPHINXOPTS%
27+
goto end
28+
29+
30+
:help
31+
%SPHINXBUILD% -M help "%SOURCEDIR%" "%BUILDDIR%" %SPHINXOPTS%
32+
goto end
33+
34+
35+
:devenv
36+
sphinx-autobuild >NUL 2>NUL
37+
if errorlevel 9009 (
2338
echo.
24-
echo.If you don't have Sphinx installed, grab it from
25-
echo.http://sphinx-doc.org/
39+
echo.The 'sphinx-autobuild' command was not found. Open and read README.md!
2640
exit /b 1
2741
)
42+
sphinx-autobuild -b html --open-browser "%SOURCEDIR%" "%BUILDDIR%/html" %SPHINXOPTS%
43+
goto end
44+
2845

29-
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
46+
:linkcheck
47+
%SPHINXBUILD% -b linkcheck "%SOURCEDIR%" "%BUILDDIR%/linkcheck" %SPHINXOPTS%
48+
echo.
49+
echo.Link check complete; look for any errors in the above output
50+
echo.or in "%BUILDDIR%/linkcheck/output.txt".
3051
goto end
3152

32-
:help
33-
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
3453

3554
:end
3655
popd

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ sphinx==4.0.2
22
sphinxcontrib-autoprogram==0.1.7
33
pydata-sphinx-theme==0.6.3
44
myst-parser==0.15.2
5+
sphinx-autobuild

docs/source/contributing/contributing.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,11 @@ Then you are good to go!
184184

185185
## Building the documentation locally
186186

187-
If you only changed the documentation, you can also build the documentation locally using `sphinx` .
187+
You can build and inspect the result of documentation changes locally.
188188

189189
```bash
190190
pip install -r docs/requirements.txt
191191

192192
cd docs/
193-
make html
193+
make devenv
194194
```
195-
196-
Then open the file `docs/build/html/index.html` in your browser.

0 commit comments

Comments
 (0)