Skip to content

Instantly share code, notes, and snippets.

@AlexanderBrevig
Created January 19, 2026 13:45
Show Gist options
  • Select an option

  • Save AlexanderBrevig/03377082a451b6af594a01afd9c91dbb to your computer and use it in GitHub Desktop.

Select an option

Save AlexanderBrevig/03377082a451b6af594a01afd9c91dbb to your computer and use it in GitHub Desktop.
Create an A5 booklet from a learnxinyminutes resource
#!/usr/bin/env fish
set lang $argv[1]
if test -z "$lang"
echo "Usage: bookify.fish <language>"
exit 1
end
set title (string upper (string sub -l 1 $lang))(string sub -s 2 $lang)
if not test -d docs
echo "Cloning learnxinyminutes-docs..."
git clone git@github.com:adambard/learnxinyminutes-docs.git docs
end
pandoc docs/$lang.md -o $lang.pdf \
-s --highlight-style kate \
-V geometry:margin=2cm \
-V fontsize=11pt \
-M title="Learn $title in Y Minutes" \
-M author="learnxinyminutes.com/$lang/" \
-M date="Bound 2026" \
--template=eisvogel \
-V titlepage=true \
-V titlepage-rule-height=0
pdfbook2 --short-edge $lang.pdf # will create "$lang-book.pdf"
rm $lang.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment