Last active
May 3, 2024 16:20
-
-
Save davidtsadler/22511a16cb6df3bc56405f486e816de5 to your computer and use it in GitHub Desktop.
Very simple script to that uses pandoc to convert a markdown file into a .mobi file that can be read on a Kindle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
MD=$1 | |
EPUB="${MD%.*}.epub" | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 <file name>." | |
exit 1 | |
fi | |
if [ ! -f $MD ]; then | |
echo "[$MD] not found." | |
exit 1 | |
fi | |
pandoc --toc $MD -o $EPUB | |
kindlegen $EPUB | |
rm $EPUB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment