diff --git a/book/default.nix b/book/default.nix index a7358b93f..98580862c 100644 --- a/book/default.nix +++ b/book/default.nix @@ -9,6 +9,7 @@ stdenv.mkDerivation { buildPhase = '' mdbook build mdbook build archive -d ../book/archive + bash ./postprocess.sh ''; installPhase = "mv book $out"; } diff --git a/book/postprocess.sh b/book/postprocess.sh new file mode 100755 index 000000000..79d4a55ae --- /dev/null +++ b/book/postprocess.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +# This file replaces `user-checkable` with actual +# checkboxes and adds CSS to the generated HTML. + +for file in $(find . -name '*.html'); do + sed -i 's|user-checkable||g' "$file" +done + +for css in $(find . -name 'general.css'); do + cat >> "$css" <<-EOF +input.user-checkable { + transform: scale(1.5); + margin-right: 8px; + margin-left: 8px; +} + +ul:has(> li > .user-checkable) { + list-style-type: none; + padding: 0; + margin: 0; +} +li:has(> .user-checkable) { + list-style-type: none; + padding: 0; + margin: 0; +} +EOF +done