Skip to content

Instantly share code, notes, and snippets.

@cferdinandi
Last active April 23, 2024 17:49
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save cferdinandi/fb72e33f69cbd52abcff9b0051b51756 to your computer and use it in GitHub Desktop.
Save cferdinandi/fb72e33f69cbd52abcff9b0051b51756 to your computer and use it in GitHub Desktop.
CLI cheats for creating a markdown ebook with Pandoc.

epub

pandoc assets/metadata.yml chapters/*.md -o book.epub -S

pdf

Using WKHTMLtoPDF (no page numbers)

pandoc assets/title.md chapters/*.md -o book.pdf -t html5 -S -V papersize:"letter" -c assets/pandoc.css

Using LaTeX (no CSS)

pandoc chapters/*.md -o book.pdf -V geometry:paperheight=8in -V geometry:paperwidth=5.25in

mobi (Kindle)

ebook-convert book.epub book.mobi

YAML

---
title:
- type: main
  text: The Web Developer Career Guide
- type: subtitle
  text: How to stay relevant, hack the hiring process, and grow your salary
creator:
- role: author
  text: Chris Ferdinandi
publisher:  Go Make Things, LLC
date: v0.2.0
rights: Copyright 2016 Chris Ferdinandi, All Rights Reserved
stylesheet: assets/pandoc.css
# cover-image: assets/cover.jpg
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment