2 ms·
Happy birthday, Pandoc! Pandoc is a key component in my Markdown-to-Kindle-and-Paperback pipeline. In fact I've soft-published an article about it: https://med
by ggambetta 10y ago
Happy birthday, Pandoc!
Pandoc is a key component in my Markdown-to-Kindle-and-Paperback pipeline. In fact I've soft-published an article about it: https://medium.com/@gabrielgambetta/how-i-wrote-and-published-my-novel-using-only-open-source-tools-5cdfbd7c00ca https://medium.com/@gabrielgambetta/how-i-wrote-and-publishe...
Amazing piece of software. Not that often a tool dominates an use case so thoroughly that there are virtually no alternatives, because there really is no need. Thank you, John MacFarlane :)
- thangalin 10y agoI had a problem converting embedded images and fonts from Markdown to EPUB; this script helps by piggy-backing on the epub-embed-font option to include images: #!/bin/bash FILENAME=$(cat title.txt).epub CSS=style.css IMAGES_DIR=images # Ensure images get embedded into the document. for url in $(grep image $CSS | grep url | sed 's/.*url( *\(.*\) *).*/\1/g'); do EMBED="$EMBED --epub-embed-font=$IMAGES_DIR/$url" done # Generate the ePub, including fonts and images. pandoc \ --smart \ --epub-cover-image=cover/cover.png \ --epub-metadata=metadata.xml \ --epub-stylesheet=$CSS \ --epub-embed-font=fonts/MyUnderwood.ttf \ $EMBED \ -t epub -o $FILENAME output/*.vars The .vars files are chapters that have their variable names substituted for values, such as: for i in chapter/*.md; do out=$OUTDIR/$(basename $i); cat variables.yaml $i > $out; pandoc $out --template $out > $out.vars cat $out.vars | sed -e 's/;;/\$/g' |\ pandoc --chapters -t context -o $OUTDIR/$(basename $i .md).tex; done A handy trick to avoid duplication (of names, places, or any text really) within the content.