Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Build the web preview (useful for testing and debugging) for my ebook. It's essentially a way to use Pandoc to convert Markdown files into a static web site. Kept the file names consistent to the epub book building process to maintain hyperlinks across chapters in both formats.
# build-web.sh
# prep the output directories
mkdir ./_web/illustrations/
mkdir ./_web/audio/
# copy assets to the web structure
rsync --verbose --update --recursive --progress --times ./illustrations/ ./_web/illustrations/
rsync --verbose --update --recursive --progress --times ./audio/ ./_web/audio/
# convert the markdown to html
pandoc -s "index.md" -c "book.css" -S -o "_web/index.html"
pandoc -s "01-chapter1.md" -c "book.css" -S -o "_web/ch001.xhtml"
pandoc -s "01-chapter2.md" -c "book.css" -S -o "_web/ch002.xhtml"
pandoc -s "01-chapter3.md" -c "book.css" -S -o "_web/ch003.xhtml"
pandoc -s "01-chapter4.md" -c "book.css" -S -o "_web/ch004.xhtml"
pandoc -s "01-chapter5.md" -c "book.css" -S -o "_web/ch005.xhtml"
pandoc -s "01-chapter6.md" -c "book.css" -S -o "_web/ch006.xhtml"
pandoc -s "01-chapter7.md" -c "book.css" -S -o "_web/ch007.xhtml"
pandoc -s "01-chapter8.md" -c "book.css" -S -o "_web/ch008.xhtml"
pandoc -s "01-chapter9.md" -c "book.css" -S -o "_web/ch009.xhtml"
pandoc -s "01-chapter10.md" -c "book.css" -S -o "_web/ch010.xhtml"
pandoc -s "01-chapter11.md" -c "book.css" -S -o "_web/ch011.xhtml"
#copy the css
cp book.css ./_web/book.css
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.