Skip to content

Commit

Permalink
Merge pull request #776 from hacspec/fix-checkbox-book
Browse files Browse the repository at this point in the history
feat(book): fix checkboxes
  • Loading branch information
W95Psp authored Jul 16, 2024
2 parents 7eb5391 + e436991 commit 23e01bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ stdenv.mkDerivation {
buildPhase = ''
mdbook build
mdbook build archive -d ../book/archive
bash ./postprocess.sh
'';
installPhase = "mv book $out";
}
29 changes: 29 additions & 0 deletions book/postprocess.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env sh

# This file replaces `<strong>user-checkable</strong>` with actual
# checkboxes and adds CSS to the generated HTML.

for file in $(find . -name '*.html'); do
sed -i 's|<strong>user-checkable</strong>|<input type="checkbox" class="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

0 comments on commit 23e01bf

Please sign in to comment.