Modernize docs Makefile with sphinx-autobuild

This commit is contained in:
Erik Sundell
2021-10-27 01:43:17 +02:00
parent c6c6e34886
commit bb158cc412
2 changed files with 28 additions and 9 deletions

View File

@@ -1,20 +1,38 @@
# Minimal makefile for Sphinx documentation # Makefile for Sphinx documentation generated by sphinx-quickstart
# # ----------------------------------------------------------------------------
# You can set these variables from the command line. # You can set these variables from the command line, and also
SPHINXOPTS = -W # from the environment for the first two.
SPHINXBUILD = sphinx-build SPHINXOPTS ?=
SPHINXPROJ = TheLittlestJupyterHub SPHINXBUILD ?= sphinx-build
SOURCEDIR = . SOURCEDIR = .
BUILDDIR = _build BUILDDIR = _build
# Put it first so that "make" without argument is like "make help". # Put it first so that "make" without argument is like "make help".
help: help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
.PHONY: help Makefile .PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new # Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). # "make mode" option.
%: Makefile %: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
# Manually added commands
# ----------------------------------------------------------------------------
# For local development:
# - builds and rebuilds html on changes to source
# - starts a livereload enabled webserver and opens up a browser
devenv:
sphinx-autobuild -b html --open-browser "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)
# For local development and CI:
# - verifies that links are valid
linkcheck:
$(SPHINXBUILD) -b linkcheck "$(SOURCEDIR)" "$(BUILDDIR)/linkcheck" $(SPHINXOPTS)
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

View File

@@ -1,3 +1,4 @@
sphinx>=1.4, !=1.5.4 sphinx>=1.4, !=1.5.4
sphinx-autobuild
sphinx_copybutton sphinx_copybutton
pydata-sphinx-theme pydata-sphinx-theme