From 12a21450ad142a2f6e5e8547af80ac649f3976ca Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 24 Mar 2024 02:10:33 +0100 Subject: [PATCH] doc/local.mk: Add manual-html-open phony target for opening browser --- doc/manual/local.mk | 10 ++++++++++ doc/manual/src/contributing/documentation.md | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/manual/local.mk b/doc/manual/local.mk index b771688854a..698a9289bc8 100644 --- a/doc/manual/local.mk +++ b/doc/manual/local.mk @@ -175,6 +175,16 @@ $(d)/src/SUMMARY-rl-next.md: $(d)/src/release-notes/rl-next.md # Generate the HTML manual. .PHONY: manual-html manual-html: $(docdir)/manual/index.html + +# Open the built HTML manual in the default browser. +manual-html-open: $(docdir)/manual/index.html + @echo " OPEN " $<; \ + xdg-open $< \ + || open $< \ + || { \ + echo "Could not open the manual in a browser. Please open '$<'" >&2; \ + false; \ + } install: $(docdir)/manual/index.html # Generate 'nix' manpages. diff --git a/doc/manual/src/contributing/documentation.md b/doc/manual/src/contributing/documentation.md index 46cca759d83..88b0bdaa9bb 100644 --- a/doc/manual/src/contributing/documentation.md +++ b/doc/manual/src/contributing/documentation.md @@ -27,11 +27,9 @@ and open `./result-doc/share/doc/nix/manual/index.html`. To build the manual incrementally, [enter the development shell](./hacking.md) and run: ```console -make manual-html -j $NIX_BUILD_CORES +make manual-html-open -j $NIX_BUILD_CORES ``` -and open `./outputs/doc/share/doc/nix/manual/language/index.html`. - In order to reflect changes to the [Makefile for the manual], clear all generated files before re-building: [Makefile for the manual]: https://github.com/NixOS/nix/blob/master/doc/manual/local.mk