From 3d55b20997d4a8f0756fc9ca3c0be52d9da25d27 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 22 Mar 2026 09:13:19 +0100 Subject: [PATCH] Add mdbook theme patch with language selector and utility links Injects a dropdown language selector and "Source code" / "Report an issue" links into utility pages via head.hbs JavaScript. --- scripts/patch-mdbook-theme.sh | 116 ++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100755 scripts/patch-mdbook-theme.sh diff --git a/scripts/patch-mdbook-theme.sh b/scripts/patch-mdbook-theme.sh new file mode 100755 index 000000000..d6c8653a5 --- /dev/null +++ b/scripts/patch-mdbook-theme.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# Patch mdbook theme to add language selector and utility links +# Usage: patch-mdbook-theme.sh [current-lang] + +set -euo pipefail + +DOCS_DIR="${1:?Usage: $0 [current-lang]}" +CURRENT_LANG="${2:-en}" + +HEAD_HBS="$DOCS_DIR/theme/head.hbs" + +# Append language selector and utility links to head.hbs +cat >> "$HEAD_HBS" << 'ENDSTYLE' + +ENDSTYLE + +# Add JavaScript for language switching and utility bar injection +cat >> "$HEAD_HBS" << ENDSCRIPT + +ENDSCRIPT + +echo "Patched $HEAD_HBS with language selector and utility links"