From 4f2751a1909739ac4951cd55d27cd6614d2a92a1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 18 Apr 2025 16:38:55 +0300 Subject: [PATCH] Add 'make [-C docs] htmllive' to rebuild and reload HTML files in your browser --- Makefile | 5 +++++ docs/Makefile | 6 ++++++ pyproject.toml | 1 + 3 files changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 53164b08a..b85dbdb06 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,10 @@ doc html: htmlview: $(MAKE) -C docs htmlview +.PHONY: htmllive +htmllive: + $(MAKE) -C docs htmllive + .PHONY: doccheck doccheck: $(MAKE) doc @@ -43,6 +47,7 @@ help: @echo " docserve run an HTTP server on the docs directory" @echo " html make HTML docs" @echo " htmlview open the index page built by the html target in your browser" + @echo " htmllive to rebuild and reload HTML files in your browser" @echo " install make and install" @echo " install-coverage make and install with C coverage" @echo " lint run the lint checks" diff --git a/docs/Makefile b/docs/Makefile index e90af0519..2cb6853d9 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -20,6 +20,7 @@ help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " htmlview to open the index page built by the html target in your browser" + @echo " htmllive to rebuild and reload HTML files in your browser" @echo " serve to start a local server for viewing docs" @echo " livehtml to start a local server for viewing docs and auto-reload on change" @echo " dirhtml to make HTML files named index.html in directories" @@ -201,6 +202,11 @@ doctest: htmlview: html $(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('$(BUILDDIR)/html/index.html'))" +.PHONY: htmllive +htmllive: SPHINXBUILD = sphinx-autobuild +htmllive: SPHINXOPTS = --open-browser --delay 0 +htmllive: html + .PHONY: livehtml livehtml: html livereload $(BUILDDIR)/html -p 33233 diff --git a/pyproject.toml b/pyproject.toml index e8e76796a..a3ff9723b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ optional-dependencies.docs = [ "furo", "olefile", "sphinx>=8.2", + "sphinx-autobuild", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph",