From 672a0820697d47621e4d54fa0048f349cfcb1899 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 25 Jan 2025 18:03:04 -0500 Subject: [PATCH 1/8] book.toml: switch from latex to typst for pdf output --- book.toml | 38 +++++++++- res/handbook-cover.svg | 162 +++++++++++++---------------------------- 2 files changed, 86 insertions(+), 114 deletions(-) diff --git a/book.toml b/book.toml index c29daced6..e36efe361 100644 --- a/book.toml +++ b/book.toml @@ -1,7 +1,7 @@ [book] authors = ["The Void Linux Team"] src = "src" -title = "Void Linux Handbook" +title = "The Void Linux Handbook" [output.html] theme = "src/theme" @@ -15,9 +15,43 @@ edit-url-template = "https://github.com/void-linux/void-docs/edit/master/{path}" "/config/gnupg.html" = "/config/openpgp.html#gnupg" "/installation/guides/arm-devices/platforms.html" = "/installation/guides/arm-devices/raspberry-pi.html" -[output.latex] +[output.typst] optional = true +[output.typst.output] +format = "pdf" + +[output.typst.style] +paper = "us-letter" +text-font = "Libertinus Serif" +link-color = "black" + +[output.typst.advanced] +typst-markup-header = """ +#let voidgreen = rgb("#478061") +#set page(paper: "us-letter") +#align(center + horizon)[ + #image("handbook-cover.svg") + #title() +] +#pagebreak() +#set page( + header: [_The Void Linux Handbook_], + numbering: "1", +) +#set par(justify: true) +#set table( + stroke: (x, y) => if y != 0 { 0.5pt } else { voidgreen }, + fill: (x, y) => if y == 0 { voidgreen }, +) +#show table.cell.where(y: 0): it => { + set text(white) + strong(it) +} +#show raw.where(block: false): box.with(fill: luma(240), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt) +#show raw.where(block: true): box.with(fill: luma(240), inset: 8pt, radius: 3pt) +""" + [output.gemini] optional = true diff --git a/res/handbook-cover.svg b/res/handbook-cover.svg index 8d0abdc5f..35e8a7c2c 100644 --- a/res/handbook-cover.svg +++ b/res/handbook-cover.svg @@ -1,126 +1,64 @@ - - - - image/svg+xml - - - - - + width="256" + height="256" + viewBox="0 0 252.06154 252.06153" + version="1.1" + preserveAspectRatio="xMidYMid" + id="voidlogo" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + + - - - - + id="logo" + transform="matrix(0.97240747,0,0,0.97240747,1.5789588,23.699565)" + style="display:inline"> + + id="letterv" + fill="#000000" + d="m 30.591915,124.81039 c -1.147564,0.81968 -2.192665,1.22952 -3.135303,1.22952 h -4.057453 c -0.573782,0 -1.024609,-0.10245 -1.352481,-0.30737 -0.327871,-0.20493 -0.59427,-0.51231 -0.799195,-0.92215 L 0.46842244,86.203138 C 0.38645233,86.121168 0.34546728,86.01871 0.34546728,85.895763 v -0.368865 c 0,-0.409842 0.14344762,-0.737718 0.43034287,-0.983628 C 1.1036817,84.256383 1.615986,84.11294 2.3127229,84.11294 H 27.579567 c 1.35248,0 2.233641,0.409841 2.643482,1.229525 L 43.010172,109.99455 78.85096,85.342465 c 1.188548,-0.819684 2.438574,-1.229525 3.750078,-1.229525 h 3.995963 c 0.532806,0 0.799208,0.225413 0.799208,0.67624 0,0.368856 -0.327871,0.819683 -0.983614,1.35248 z" /> + id="lettero" + fill="#000000" + d="m 86.35303,126.03991 c -2.131187,0 -4.016463,-0.32787 -5.65583,-0.98362 -1.639384,-0.69673 -3.012366,-1.63937 -4.118944,-2.82792 -1.106579,-1.18855 -1.946755,-2.58201 -2.520528,-4.18039 -0.573773,-1.63938 -0.860659,-3.40171 -0.860659,-5.287 0,-2.41807 0.409842,-4.79516 1.229525,-7.13126 0.819683,-2.33611 1.946754,-4.56976 3.381213,-6.70095 1.475427,-2.131187 3.196763,-4.098434 5.16401,-5.901741 2.008232,-1.803315 4.180404,-3.360721 6.516517,-4.672216 2.377097,-1.311495 4.877141,-2.336103 7.500131,-3.073825 2.623008,-0.778698 5.307485,-1.168047 8.053425,-1.168047 h 30.12348 c 2.17218,0 4.07795,0.327871 5.71734,0.983614 1.68035,0.655752 3.07381,1.577903 4.18039,2.766451 1.10658,1.147555 1.94676,2.520527 2.52053,4.118918 0.57379,1.59839 0.86069,3.340224 0.86069,5.2255 0,2.418083 -0.43034,4.815666 -1.29101,7.192756 -0.8197,2.33611 -1.96726,4.56976 -3.44269,6.70094 -1.47544,2.13118 -3.21728,4.11893 -5.22551,5.96323 -2.00823,1.80331 -4.2009,3.3812 -6.57799,4.73368 -2.37708,1.3115 -4.87713,2.35661 -7.50013,3.13531 -2.62299,0.73772 -5.26649,1.10657 -7.93048,1.10657 z m 37.00886,-25.1439 c 1.35249,-2.868898 2.02874,-5.020573 2.02874,-6.455023 0,-1.188549 -0.43035,-2.008237 -1.29103,-2.459063 -0.81969,-0.450827 -2.04921,-0.67624 -3.68858,-0.67624 h -8.36081 c -1.18854,0 -2.29512,0.163935 -3.31974,0.491807 -0.98363,0.286895 -1.90577,0.7992 -2.76644,1.536913 -0.86067,0.737722 -1.70084,1.72135 -2.52053,2.950883 -0.77869,1.229526 -1.57788,2.766434 -2.39757,4.610723 l -2.950895,6.70095 c -1.557397,3.48367 -2.336095,6.10667 -2.336095,7.869 0,1.18854 0.348364,2.04921 1.045092,2.582 0.696746,0.49181 1.700862,0.73772 3.012348,0.73772 h 8.42229 c 1.27052,0 2.43858,-0.18443 3.50417,-0.55328 1.0656,-0.40985 2.09021,-1.04511 3.07383,-1.90578 0.98362,-0.86067 1.92626,-2.00823 2.82791,-3.44268 0.90166,-1.43445 1.8238,-3.19678 2.76644,-5.28698 z" /> + id="letteri" + fill="#000000" + d="m 144.12269,126.03991 c -0.73771,0 -1.10657,-0.2459 -1.10657,-0.73771 0,-0.2459 0.0615,-0.55329 0.18444,-0.92215 l 17.27487,-38.668719 c 0.49183,-1.065594 1.27053,-1.59839 2.33613,-1.59839 h 21.14791 c 0.7787,0 1.16805,0.266394 1.16805,0.799182 0,0.24591 -0.082,0.512313 -0.24589,0.799208 L 167.6682,124.38005 c -0.49182,1.10658 -1.27052,1.65986 -2.33612,1.65986 z" /> + id="letterd" + fill="#000000" + d="m 174.34897,126.03991 c -0.73772,0 -1.10657,-0.2459 -1.10657,-0.73771 0,-0.2459 0.0615,-0.55329 0.18443,-0.92215 l 17.27488,-38.668719 c 0.49182,-1.065594 1.27053,-1.59839 2.33612,-1.59839 h 49.42712 c 2.13119,0 4.01646,0.327871 5.65583,0.983614 1.63937,0.655752 3.01234,1.577903 4.11892,2.766451 1.10657,1.147555 1.94676,2.520527 2.52055,4.118918 0.57377,1.59839 0.86066,3.340224 0.86066,5.2255 0,2.500053 -0.43033,4.959116 -1.291,7.377186 -0.86067,2.37709 -2.04922,4.63123 -3.56565,6.76242 -1.47543,2.13118 -3.23775,4.09843 -5.28696,5.90174 -2.00824,1.80331 -4.2009,3.36072 -6.578,4.67221 -2.33611,1.27052 -4.79517,2.27464 -7.37717,3.01235 -2.58203,0.73772 -5.16404,1.10658 -7.74605,1.10658 z m 53.48456,-25.1439 c 1.3115,-2.950868 1.96725,-5.102543 1.96725,-6.455023 0,-1.188549 -0.40984,-2.008237 -1.22952,-2.459063 -0.81969,-0.450827 -2.00824,-0.67624 -3.56565,-0.67624 h -12.47973 l -12.17235,27.479996 h 12.41826 c 1.22953,0 2.37709,-0.18443 3.44269,-0.55328 1.06559,-0.40985 2.06971,-1.0451 3.01234,-1.90578 0.98363,-0.90166 1.92627,-2.04921 2.82792,-3.44268 0.94264,-1.43445 1.88528,-3.19678 2.82791,-5.28698 z" /> - - - - Void Handbook - - - - Void is a general purpose operating system, based on - - - the monolithic Linux kernel. Its package system - - - allows you to quickly install, update and remove - - - software; software is provided in binary packages or - - - can be built directly from sources with the help of the - - - XBPS source packages collection. - - From 3f102023154f324f8514053e97f20f07b2a2e5d9 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Mon, 22 Dec 2025 09:27:04 -0500 Subject: [PATCH 2/8] config/date-time: make section headers unique --- src/config/date-time.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/date-time.md b/src/config/date-time.md index 4f7c71578..e47cb95ee 100644 --- a/src/config/date-time.md +++ b/src/config/date-time.md @@ -54,7 +54,7 @@ service](../config/services/index.md#managing-services) for it, either through its own service or the `ntpd` service managed by [xbps-alternatives(1)](https://man.voidlinux.org/xbps-alternatives.1). -### NTP +### ISC NTP NTP is the official reference implementation of the Network Time Protocol. From afc41e5b6bf7a3ebc46058b0aa8f851b6e876b90 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Mon, 22 Dec 2025 09:27:27 -0500 Subject: [PATCH 3/8] config/network/firewalls: fix anchor link --- src/config/network/firewalls.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/network/firewalls.md b/src/config/network/firewalls.md index 5a0309e76..40fc8eba3 100644 --- a/src/config/network/firewalls.md +++ b/src/config/network/firewalls.md @@ -78,7 +78,7 @@ This adds a core-service which restores the ruleset in `/etc/nftables.conf`. ### Applying the rules at runtime The `nftables` package provides the `nftables` service, which uses rules from -`/etc/nftables.conf`. Once you [enable](../services/index.md#enabling-service) +`/etc/nftables.conf`. Once you [enable](../services/index.md#enabling-services) the `nftables` service, to load the rules, run: ``` From 2995894f67ed817f26085e08020349338eb1b103 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 25 Dec 2025 13:55:07 -0500 Subject: [PATCH 4/8] src: fix admonitions --- src/config/graphical-session/graphics-drivers/nvidia.md | 6 +++--- src/installation/live-images/prep.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config/graphical-session/graphics-drivers/nvidia.md b/src/config/graphical-session/graphics-drivers/nvidia.md index a75f03dc0..a8c031e9e 100644 --- a/src/config/graphical-session/graphics-drivers/nvidia.md +++ b/src/config/graphical-session/graphics-drivers/nvidia.md @@ -21,9 +21,9 @@ which is primarily useful on older cards with specialized fixed function hardware (the `modesetting` driver will accelerate 2D using OpenGL via GLAMOR). When in doubt, it's a good idea to try `xf86-video-nouveau` first. -Note: `xf86-video-nouveau` is usually installed by default if you use the `xorg` -metapackage. If you use `xorg-minimal`, you will need to install it manually, -either directly or through `xorg-video-drivers`. +> Note: `xf86-video-nouveau` is usually installed by default if you use the +> `xorg` metapackage. If you use `xorg-minimal`, you will need to install it +> manually, either directly or through `xorg-video-drivers`. ## nvidia (Proprietary Driver) diff --git a/src/installation/live-images/prep.md b/src/installation/live-images/prep.md index 2a0235a34..3ddf48aea 100644 --- a/src/installation/live-images/prep.md +++ b/src/installation/live-images/prep.md @@ -39,8 +39,8 @@ umount: /dev/sdX: not mounted. The [dd(1)](https://man.voidlinux.org/man1/dd.1) command can be used to copy a live image to a storage device. Using `dd`, write the live image to the device: -**Warning**: this will destroy any data currently on the referenced device. -Exercise caution. +> **Warning**: this will destroy any data currently on the referenced device. +> Exercise caution. ``` # dd bs=4M if=/path/to/void-live-ARCH-DATE-VARIANT.iso of=/dev/sdX From 5d40b3b075aa2a683eef54908211e984923d55df Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 25 Dec 2025 13:58:02 -0500 Subject: [PATCH 5/8] Makefile: add, replaces res/{build,install}.sh --- Makefile | 52 ++++++++++++++++++++++++++++ README.md | 15 +++----- res/build.sh | 92 -------------------------------------------------- res/install.sh | 19 ----------- 4 files changed, 57 insertions(+), 121 deletions(-) create mode 100644 Makefile delete mode 100755 res/build.sh delete mode 100755 res/install.sh diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..dd20fe591 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +PREFIX := /usr/local + +SOURCES = $(shell find src -not -path 'src/theme*' -type f -name '*.md') +MANPAGES = $(subst src/,book/mandoc/,$(patsubst %.md,%.7,$(SOURCES))) +UTILS = book/void-docs book/void-docs.1 + +all: void-book void-docs mandoc + +install: all + install -Dm0755 book/void-docs $(DESTDIR)$(PREFIX)/bin/void-docs + install -Dm0644 book/void-docs.1 $(DESTDIR)$(PREFIX)/share/man/man1/void-docs.1 + + install -Dm0644 book/typst/book.pdf $(DESTDIR)$(PREFIX)/share/doc/void/handbook.pdf + + cp -r src/ $(DESTDIR)$(PREFIX)/share/doc/void/markdown + rm -fr $(DESTDIR)$(PREFIX)/share/doc/void/markdown/theme + + cp -r book/html $(DESTDIR)$(PREFIX)/share/doc/void/html + + cp -r book/mandoc $(DESTDIR)$(PREFIX)/share/doc/void/mandoc + +void-docs: $(UTILS) + +$(UTILS): book/%: res/%.in book + sed -e "s,@PREFIX@,$(PREFIX)," $< >$@ + +void-book: $(SOURCES) book/typst/handbook-cover.svg + mdbook build + +book/typst/handbook-cover.svg: res/handbook-cover.svg book/typst + cp -a $< $@ + +mandoc: $(MANPAGES) + +book/mandoc/%.7: src/%.md book/mandoc + @mkdir -p $(@D) + lowdown -T man -m "title: $(*F)" -m "date: $$(git log --pretty='%cs' -1 $< 2>/dev/null || date -d @$$SOURCE_DATE_EPOCH +%F)" \ + -m "section: 7" -m "source: The Void Linux Handbook" -m "volume: The Void Linux Handbook" -s -o $@ $< + +book: + mkdir -p book + +book/typst: book + mkdir -p book/typst + +book/mandoc: book + mkdir -p book/mandoc + +clean: + rm -rf book + +.PHONY: all install void-docs void-book mandoc clean diff --git a/README.md b/README.md index d1cba8e7d..bdfb947af 100644 --- a/README.md +++ b/README.md @@ -7,20 +7,15 @@ the same protocol as the packages tree. For details, please read ## Building -The [res/build.sh](./res/build.sh) script builds HTML, roff and PDF versions of -the Void documentation and the `void-docs.1` man page. It requires the following -Void packages: +The `Makefile` builds HTML, roff and PDF versions of the Void documentation and +the `void-docs.1` man page. It requires the following Void packages: - `mdBook` - `findutils` - `lowdown` (version 0.8.1 or greater) -- `texlive` -- `perl` -- `perl-File-Which` -- `perl-JSON` -- `librsvg-utils` +- `mdbook-typst` +- `mdbook-linkcheck` - `python3-md2gemini` In order to build and install these files, set the `PREFIX` and `DESTDIR` -environment variables to appropriate values and run `res/build.sh` followed by -`res/install.sh`. +variables to appropriate values and run `make` to build, and `make install` to install. diff --git a/res/build.sh b/res/build.sh deleted file mode 100755 index 22f3a7574..000000000 --- a/res/build.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh -# uses PREFIX and BUILD_MANPAGES from environment -: "${PREFIX:=/usr/local}" -: "${BUILD_MANPAGES:=1}" - -set -e -PATH="$PWD/res:$PATH" - -if [ -z "$SOURCE_DATE_EPOCH" ]; then - export SOURCE_DATE_EPOCH=$(git log --pretty='%ct' -1) - if [ -z "$SOURCE_DATE_EPOCH" -a "$BUILD_MANPAGES" = 1 ]; then - echo "git or SOURCE_DATE_EPOCH are needed to build man pages!" - exit 1 - fi -fi - -# Build HTML mdbook -echo "Building mdBook" -mdbook build - -if [ "$BUILD_MANPAGES" = "1" ]; then - # Build mandoc version - echo "Building man pages" - cd src - - find . -type d -exec mkdir -p "../mandoc/{}" \; - - find . -type f -name "*.md" -exec sh -c \ - 'file="{}"; filew="${file%.md}"; \ - man_date="$(git log --pretty=%cs -1 "$file" 2>/dev/null || date -d "@$SOURCE_DATE_EPOCH" +%F)"; - lowdown -Tman \ - ${man_date:+-m "date: $man_date"} \ - -m "title: ${filew##*/}" \ - -m "section: 7" -m "source: Void Docs" -m "volume: Void Docs" \ - -s -o "../mandoc/${filew}.7" "$file"' \; - - cd - -fi - -# Build script -echo "Building void-docs script and man page" -sed -e "s,@PREFIX@,$PREFIX," res/void-docs.in > res/void-docs -sed -e "s,@PREFIX@,$PREFIX," res/void-docs.1.in > res/void-docs.1 - -# Build PDF - -echo "Building PDF" - -## Temporarily add OpenType version of Latin Modern to font cache. - -mkdir -p ~/.fonts -TMP_FONTDIR=$(mktemp -d -p ~/.fonts) -cp /usr/share/texmf-dist/fonts/opentype/public/lm/* $TMP_FONTDIR -fc-cache - -## Create cover page using Latin Modern text. - -rsvg-convert \ - --dpi-x 300 \ - --dpi-y 300 \ - res/handbook-cover.svg > res/handbook-cover.png - -## Letter version - -pdflatex \ - -output-directory=book/latex/ \ - -jobname=handbook-letter \ - book/latex/handbook.tex \ - >/dev/null -pdflatex \ - -output-directory=book/latex/ \ - -jobname=handbook-letter \ - book/latex/handbook.tex \ - >/dev/null - -## A4 version - -sed -ie "s/\\documentclass\[letterpaper\]{article}/\\documentclass[a4paper]{article}/" \ - book/latex/handbook.tex -pdflatex -output-directory=book/latex/ \ - -jobname=handbook-a4 \ - book/latex/handbook.tex \ - >/dev/null -pdflatex -output-directory=book/latex/ \ - -jobname=handbook-a4 \ - book/latex/handbook.tex \ - >/dev/null - -## Remove temporary font directory - -rm -rf $TMP_FONTDIR -fc-cache diff --git a/res/install.sh b/res/install.sh deleted file mode 100755 index 9142db937..000000000 --- a/res/install.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# uses PREFIX and DESTDIR from environment -: "${PREFIX:=/usr/local}" - -set -e - -DOC=${DESTDIR}${PREFIX}/share/doc/void -mkdir -p $DOC/ - -cp -r src/ $DOC/markdown -rm -fr $DOC/markdown/theme - -cp -r book/html $DOC/html - -cp -r mandoc/ $DOC/mandoc - -install -Dm0644 res/void-docs.1 ${DESTDIR}${PREFIX}/share/man/man1/void-docs.1 -install -Dm0755 res/void-docs ${DESTDIR}${PREFIX}/bin/void-docs -install -Dm0644 book/latex/handbook-a4.pdf ${DESTDIR}${PREFIX}/share/doc/void/handbook.pdf From 20d7b370cdc568019714b70d19b67fbb6e414d1d Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 25 Dec 2025 13:59:25 -0500 Subject: [PATCH 6/8] res: clean up latex-related stuff --- res/README.md | 2 - res/handbook-cover-variants.svg | 1319 ------------------------------- res/mdbook-latex | 389 --------- 3 files changed, 1710 deletions(-) delete mode 100644 res/README.md delete mode 100644 res/handbook-cover-variants.svg delete mode 100755 res/mdbook-latex diff --git a/res/README.md b/res/README.md deleted file mode 100644 index 7031b5195..000000000 --- a/res/README.md +++ /dev/null @@ -1,2 +0,0 @@ -The original cover variants, as suggested by @argosatcore on GitHub, -are available in the `handbook-cover-variants.svg` file. diff --git a/res/handbook-cover-variants.svg b/res/handbook-cover-variants.svg deleted file mode 100644 index 5f2c34694..000000000 --- a/res/handbook-cover-variants.svg +++ /dev/null @@ -1,1319 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - Void Handbook - - ENTER -THE - - - - - - - - - - Void is a general purpose operating system, based on the monolithic Linux® kernel. Its package system allows you to quickly install, update and remove software; software is provided in binary packages or can be built directly from sources with the help of the XBPS source packages collection. - - Void Handbook - - ENTER -THE - - - - - - - - - - Void is a general purpose operating system, based on the monolithic Linux® kernel. Its package system allows you to quickly install, update and remove software; software is provided in binary packages or can be built directly from sources with the help of the XBPS source packages collection. - - Void Handbook - - ENTER -THE - - - - - - - - - - Void is a general purpose operating system, based on the monolithic Linux® kernel. Its package system allows you to quickly install, update and remove software; software is provided in binary packages or can be built directly from sources with the help of the XBPS source packages collection. - - Void Handbook - - ENTER -THE - - - - - - - - - - Void is a general purpose operating system, based on the monolithic Linux® kernel. Its package system allows you to quickly install, update and remove software; software is provided in binary packages or can be built directly from sources with the help of the XBPS source packages collection. - - Void Handbook - - ENTER -THE - - - - - - - - - - Void is a general purpose operating system, based on the monolithic Linux® kernel. Its package system allows you to quickly install, update and remove software; software is provided in binary packages or can be built directly from sources with the help of the XBPS source packages collection. - - Void Handbook - - ENTER -THE - - - - - - - - - - Void is a general purpose operating system, based on the monolithic Linux® kernel. Its package system allows you to quickly install, update and remove software; software is provided in binary packages or can be built directly from sources with the help of the XBPS source packages collection. - - diff --git a/res/mdbook-latex b/res/mdbook-latex deleted file mode 100755 index e2bb888dc..000000000 --- a/res/mdbook-latex +++ /dev/null @@ -1,389 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Cwd; -use JSON; - -my $data; -{ - local $/; - undef $/; - $data = <>; -} -my $json = JSON->new->decode($data); -my $sections = $json->{book}->{sections}; - -my $date = `date '+%d %B %Y'`; -chomp $date; - -my $latex; -my %code_inline; -my $code_inline_index = 0; -my %codeblocks; -my $codeblock_index = 0; - -# Opening. - -$latex .= "\\documentclass[letterpaper]{article}\n"; -$latex .= "\\usepackage[margin=4cm]{geometry}\n"; -$latex .= "\\usepackage[T1]{fontenc}\n"; -$latex .= "\\fontfamily{lmodern}\n"; -$latex .= "\\selectfont\n"; -$latex .= "\\usepackage{graphicx}\n"; -$latex .= "\\usepackage{hyperref}\n"; -$latex .= "\\usepackage{listings}\n"; -$latex .= "\\lstdefinestyle{void}{\n"; -$latex .= " basicstyle=\\ttfamily,\n"; -$latex .= " breaklines=true,\n"; -$latex .= " showstringspaces=false,\n"; -$latex .= " aboveskip=\\bigskipamount,\n"; -$latex .= " belowskip=\\bigskipamount,\n"; -$latex .= "}\n"; -$latex .= "\\def\\code#1{\\texttt{#1}}\n"; -$latex .= "\\begin{document}\n"; -$latex .= "\\newgeometry{margin=2cm}\n"; -$latex .= "\\begin{titlepage}\n"; -$latex .= " \\includegraphics[width=160mm,height=230mm]{res/handbook-cover.png}\n"; -$latex .= "\\end{titlepage}\n"; -$latex .=" \\restoregeometry\n"; -$latex .= "\\title{Void Handbook}\n"; -$latex .= "\\date{$date}\n"; -$latex .= "\\maketitle\n"; -$latex .= "\\setcounter{tocdepth}{5}\n"; -$latex .= "\\tableofcontents\n"; -$latex .= "\\begin{sloppypar}\n"; # Ugly; need to find better solution - -# Contents. - -foreach my $i (@$sections) { - process_json($i); -} - -# Postprocessing. - -$latex =~ s/config-network-wpa\\_supplicant/config-network-wpa_supplicant/g; -$latex =~ s/config-network-wpa_supplicant-the-wpa\\_supplicant-service/config-network-wpa_supplicant-the-wpa_supplicant-service/g; -$latex =~ s/(handbook-codeblock-\d+)/$codeblocks{$1}/eg; -$latex =~ s/(handbook-codeinline-\d+)/$code_inline{$1}/eg; - -# Closing. - -$latex .= "\\end{sloppypar}\n"; -$latex .= "\\end{document}\n"; - -open(my $fh, ">", "handbook.tex") - or die "Can't open handbook.tex for writing: $!"; -print $fh $latex; -close($fh) - or die "Couldn't close handbook.tex after writing: $!"; - -exit 0; - -sub process_json { - - my $i = shift; - my $type = ref($i); - if ($type eq 'HASH') { - if (defined $i->{content}) { - process_content($i->{path},$i->{content}); - } - if (defined $i->{Chapter}) { - process_json($i->{Chapter}); - } - if (defined $i->{sub_items}) { - foreach my $j ($i->{sub_items}) { - process_json($j); - } - } - } - if ($type eq 'ARRAY') { - foreach my $j (@{$i}) { - process_json($j); - } - } -} - -sub process_content { - - my $path = shift; - my $content = shift; - my $base = convert_path_to_hypertarget_base($path); - - # Create sections. - $content =~ s/^# ([^\n]+)/create_sectioning("section",$1,$base)/eg; - - # Create subsections. - $content =~ s/\n## ([^\n]+)/create_sectioning("subsection",$1,$base)/eg; - - # Create subsubsections. - $content =~ s/\n### ([^\n]+)/create_sectioning("subsubsection",$1,$base)/eg; - - # Create paragraphs. - $content =~ s/\n#### ([^\n]+)/create_sectioning("paragraph",$1,$base)/eg; - - # Create subparagraphs. - $content =~ s/\n##### ([^\n]+)/create_sectioning("subparagraph",$1,$base)/eg; - - # Create codeblocks. - $content =~ s/```\n(.+?)\n```/create_codeblock($1)/esg; - - # Create internal links. - $content =~ s/\[([^]]+?)\]\(((?:\..?.+?)|(?:#.+?))\)/create_internal_link($1,$2,$path)/esg; - - # Create external links. - $content =~ s/<(http[^>]+)>/\\href{$1}{$1}/sg; # bare links - $content =~ s/\[([^]]+?)\]\((.+?)\)/\\href{$2}{$1}/sg; - - # Create lists. - $content =~ s/\n\n(- .+?)\n(?:\n|\z)/create_list($1)/esg; - - # Create numbered lists. - $content =~ s/\n\n(\d+\. .+?)\n(?:\n|\z)/create_numbered_list($1)/esg; - - # Create blockquotes. - $content =~ s/((^>(?:\s*\n|[^\n]+))+)/create_blockquote($1)/emsg; - - # Bold text. - $content =~ s/\*\*([^*]+)\*\*/{\\bfseries $1}/sg; - - # Escape LaTeX special characters. - $content =~ s/#/'\#'/eg; - $content =~ s/\$/'\$'/eg; - $content =~ s/_/'\_'/eg; - $content =~ s/~/'\~'/eg; - $content =~ s/&/'\&'/eg; - $content =~ s/\^/'\^'/eg; - - # Create tables. - $content =~ s/((?:(?:\| +[^|]+ +\| +(?:[^|]+ +\|)+\n)|(?:\|-[^\n]+\n))+)/create_table($1)/esg; - - # Create inline code. - $content =~ s/(?: |\n)`([^`]+)`/create_code_inline($1)/esg; - - $latex .= $content; - -} - -sub convert_heading_to_fragment { - - my $heading = shift; - - $heading =~ s/ /-/g; - $heading =~ s/\.//g; - $heading =~ s/\(|\)//g; - $heading =~ s/(.+)/lc($1)/e; - - return $heading; - -} - -sub convert_path_to_hypertarget_base { - - my $base = shift; - - if ($base =~ m|index.md|) { - $base =~ m|(.+/index).md|; - $base = $1; - $base =~ s|/|-|g; - } else { - $base =~ m|(.+).md|; - $base = $1; - $base =~ s|/|-|g; - } - - return $base; - -} - -sub create_blockquote { - - my $blockquote = shift; - my $result; - - $blockquote =~ s/>//g; - $blockquote =~ s/\n//g; - - $result .= "\\begin{quote}\n"; - $result .= $blockquote; - $result .= "\\end{quote}\n"; - - return $result; - -} - -sub create_codeblock { - - my $codeblock = shift; - my $label; - my $result; - - $codeblock_index++; - $label = 'handbook-codeblock-' . $codeblock_index; - - $result .= "\\begin{lstlisting}[style=void]\n"; - $result .= $codeblock; - $result .= "\n\\end{lstlisting}\n"; - - $codeblocks{$label} = $result; - - # Mark places in document where codeblock will be re-inserted - # during postprocessing. - return $label; - -} - -sub create_code_inline { - - my $code = shift; - my $label; - my $result; - - $code_inline_index++; - $label = 'handbook-codeinline-' . $code_inline_index; - - $result = " \\code{$code}"; - - $code_inline{$label} = $result; - - # Mark places in document where code will be re-inserted - # during postprocessing. - return $label; - -} - -sub create_internal_link { - - my $text = shift; - my $destination = shift; - my $current_section = shift; - my $current_directory; - my $base; - my $fragment; - my $hypertarget; - my $result; - - if ($destination =~ /^#/) { - $base = $current_section . $destination; - $base =~ s|.md#.+$||; - } else { - $current_section =~ m|^(.+/)|; - $current_directory = $1; - $base = $destination; - $base =~ m|^(.+\.md)|; - $base = $1; - $base = $current_directory . $base; - $base = Cwd::abs_path("../../src/" . $base); - $base =~ s|^.+/src/||; - $base =~ s|.md||; - } - $base =~ s|/|-|g; - - if ($destination =~ /#/) { - $destination =~ m|#(.+)$|; - $fragment = "-" . $1; - } else { - $fragment = ""; - } - - $text =~ s/\n/ /; - $hypertarget = $base . $fragment; - $result = "\\hyperlink{$hypertarget}{$text}"; - - return $result; - -} - -sub create_list { - - my $list = shift; - my $result; - - $result .= "\n\\begin{itemize}\n"; - $list =~ s/^- /\\item /mg; - $result .= $list; - $result .= "\n\\end{itemize}\n"; - - return $result; - -} - -sub create_numbered_list { - - my $list = shift; - my $result; - - $result .= "\n\\begin{enumerate}\n"; - $list =~ s/^\d+\. /\\item /mg; - $result .= $list; - $result .= "\n\\end{enumerate}\n"; - - return $result; - -} - -sub create_sectioning { - - my $type = shift; - my $text = shift; - my $name = shift; - my $result; - - if ($type ne "section") { - $name = $name . "-" . convert_heading_to_fragment($text); - $result .= "\n\\hypertarget{"; - $result .= $name; - $result .= "}{}"; - $result .= "\n\\$type\{$text\}\n"; - } else { - $result .= "\n\\newpage\n"; - $result .= "\n\\hypertarget{"; - $result .= $name; - $result .= "}{}"; - $result .= "\n\\$type\{$text\}\n"; - } - - return $result; - -} - -sub create_table { - - my $table = shift; - my $result; - my @lines; - my $header; - my @body; - my $column_count; - - @lines = split(/\n/, $table); - $header = $lines[0]; - $header =~ s/[^|]//g; - $column_count = length($header) - 1; - - $result .= "\n\\bigskip"; - $result .= "\n\\begin{tabular}{ | "; - $result .= "l | " x ($column_count - 1); - $result .= "l | }\n"; - $result .= "\\hline\n"; - $header = $lines[0]; - $header =~ s/^\|//; - $header =~ s/\|/&/g; - $header =~ s/&$//; - $result .= $header; - $result .= "\\\\ \\hline \\hline\n"; - shift @lines; - foreach my $line (@lines) { - if ($line !~ /^\|-/) { - $line =~ s/^\|//; - $line =~ s/\|/&/g; - $line =~ s/&$//; - $result .= $line; - $result .= "\\\\ \\hline\n"; - } - } - $result .= "\n\\end{tabular}\n"; - $result .= "\n\\bigskip\n"; - -} From bc4333f42dee01a4bdfcd22313daaacd78c866fa Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 25 Dec 2025 13:59:41 -0500 Subject: [PATCH 7/8] check.sh: shellcheck --- check.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/check.sh b/check.sh index 9a77d43e6..30fb2a897 100755 --- a/check.sh +++ b/check.sh @@ -3,13 +3,13 @@ # reset variable so it doesn't use the environment one MISSING= -echo -n "Checking for mdbook-linkcheck ... " +printf "Checking for mdbook-linkcheck ... " if ! command -v mdbook-linkcheck; then MISSING="$MISSING mdbook-linkcheck" echo "not found" fi -echo -n "Checking for vmdfmt ... " +printf "Checking for vmdfmt ... " if ! command -v vmdfmt; then MISSING="$MISSING vmdfmt" echo "not found" @@ -17,14 +17,14 @@ fi if [ "$MISSING" ]; then - echo -n "Checking for xbps-install ... " + printf "Checking for xbps-install ... " if ! command -v xbps-install; then echo "not found" echo "Please manually install: $MISSING" exit 1 fi - echo -n "Checking for sudo ... " + printf "Checking for sudo ... " if command -v sudo; then SU_CMD='sudo' else @@ -39,14 +39,14 @@ if [ "$MISSING" ]; then fi fi - echo "\nTrying to install ${MISSING## } ... " + printf "\nTrying to install %s ... " "${MISSING## }" $SU_CMD xbps-install $MISSING echo # Check whether executables are now present. - + for i in $MISSING; do - if ! command -v $i 2>&1 >/dev/null; then + if ! command -v "$i" >/dev/null 2>&1; then UNAVAILABLE="$UNAVAILABLE $i" fi done @@ -60,7 +60,7 @@ fi vmdfmt -l -w src/ -if command -v mdbook 2>&1 >/dev/null; then +if command -v mdbook >/dev/null 2>&1; then echo "Building book and checking links with mdbook ..." mdbook build else From 02e6708b5493ed00bb7ddddd6e1a6f31484a98b7 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 25 Dec 2025 14:25:10 -0500 Subject: [PATCH 8/8] book.toml: clean up linkcheck exclusions, fix a couple links --- book.toml | 20 +++++++++++-------- .../guides/arm-devices/raspberry-pi.md | 2 +- src/installation/guides/fde.md | 6 +++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/book.toml b/book.toml index e36efe361..278114c78 100644 --- a/book.toml +++ b/book.toml @@ -25,6 +25,8 @@ format = "pdf" paper = "us-letter" text-font = "Libertinus Serif" link-color = "black" +# XXX: needs fix for zeros showing up +# heading-numbering = "1.1" [output.typst.advanced] typst-markup-header = """ @@ -50,6 +52,11 @@ typst-markup-header = """ } #show raw.where(block: false): box.with(fill: luma(240), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt) #show raw.where(block: true): box.with(fill: luma(240), inset: 8pt, radius: 3pt) +// XXX: needs fix for zeros showing up +#let skip_zeros(..args) = { + numbering("1.1", ..args.pos().filter((i) => i != 0)) +} +#set heading(numbering: skip_zeros) """ [output.gemini] @@ -60,16 +67,13 @@ optional = true follow-web-links = true exclude = [ 'kernel\.org', - 'ntp\.org', '\.onion', 'localhost', - 'userbase\.kde\.org', - 'sjtu\.edu\.cn', - 'mirrors\.cnnic\.cn', - 'void\.webconverger\.org', - 'mirror\.vofr\.net', - 'void\.chililinux\.com', - 'voidlinux\.com\.br', 'reddit\.com', 'raspberrypi\.com', + 'xnux\.eu', + 'canonical\.com', + 'freedesktop\.org', + 'libressl\.org', ] +user-agent = "Mozilla/5.0" diff --git a/src/installation/guides/arm-devices/raspberry-pi.md b/src/installation/guides/arm-devices/raspberry-pi.md index 1a64e946b..53460f9e0 100644 --- a/src/installation/guides/arm-devices/raspberry-pi.md +++ b/src/installation/guides/arm-devices/raspberry-pi.md @@ -12,7 +12,7 @@ functionality. The [command line](../../../config/kernel.md#cmdline) parameters passed to the kernel are in the `/boot/cmdline.txt` file. Some of the relevant parameters are documented in the [official -documentation](https://www.raspberrypi.com/documentation/computers/configuration.html#the-kernel-command-line). +documentation](https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-command-line-cmdline-txt). ## Supported Models diff --git a/src/installation/guides/fde.md b/src/installation/guides/fde.md index f177ea1ea..727c51cde 100644 --- a/src/installation/guides/fde.md +++ b/src/installation/guides/fde.md @@ -52,9 +52,9 @@ LUKS2 is only partially supported by GRUB; specifically, only the PBKDF2 key derivation function is [implemented](https://git.savannah.gnu.org/cgit/grub.git/commit/?id=365e0cc3e7e44151c14dd29514c2f870b49f9755), which is *not* the default KDF used with LUKS2, that being Argon2i ([GRUB Bug -59409](https://savannah.gnu.org/bugs/?59409)). LUKS encrypted partitions using -Argon2i (as well as the other KDF) can *not* be decrypted. For that reason, this -guide only recommends LUKS1 be used. +59409](https://web.archive.org/web/20250320141758/https://savannah.gnu.org/bugs/?59409)). +LUKS encrypted partitions using Argon2i (as well as the other KDF) can *not* be +decrypted. For that reason, this guide only recommends LUKS1 be used. Keep in mind the encrypted volume will be `/dev/sda2` on EFI systems, since `/dev/sda1` is taken up by the EFI partition.